From 616fc76173e79ee9d65477d8185f44370f4c468d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 15 Sep 2019 01:35:16 +0200 Subject: [PATCH] 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 --- src/qt/frame.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp index be927ce2cd..20c84d747a 100644 --- a/src/qt/frame.cpp +++ b/src/qt/frame.cpp @@ -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 )