Don't use default window style hints in wxFrame

Building on windowFlags() meant that we inherited a bunch of default
flags that were not affected by Qt::CustomizeWindowHint because we
explicitly specified them when calling setWindowFlags().

Instead of doing this, start with nothing and just add the styles that
we need.

This notably ensures that the frames created without wxCLOSE_BOX style
actually don't have any close button.

Closes https://github.com/wxWidgets/wxWidgets/pull/1335
This commit is contained in:
Vadim Zeitlin
2019-09-15 01:35:16 +02:00
parent dfc6cdc063
commit 616fc76173

View File

@@ -134,15 +134,16 @@ void wxFrame::SetWindowStyleFlag( long style )
{
wxWindow::SetWindowStyleFlag( style );
QMainWindow *qtFrame = GetQMainWindow();
Qt::WindowFlags qtFlags = qtFrame->windowFlags();
qtFlags |= Qt::CustomizeWindowHint;
Qt::WindowFlags qtFlags = Qt::CustomizeWindowHint;
if ( HasFlag( wxFRAME_TOOL_WINDOW ) )
{
qtFlags &= ~Qt::WindowType_Mask;
qtFlags |= Qt::Tool;
}
else
{
qtFlags |= Qt::Window;
}
if ( HasFlag(wxCAPTION) )
{
@@ -183,8 +184,7 @@ void wxFrame::SetWindowStyleFlag( long style )
qtFlags |= Qt::FramelessWindowHint;
}
qtFrame->setWindowFlags(qtFlags);
GetQMainWindow()->setWindowFlags(qtFlags);
}
void wxFrame::AddChild( wxWindowBase *child )