Implement support for wxFrame style flags for wxQt

Closes https://github.com/wxWidgets/wxWidgets/pull/1222
This commit is contained in:
Graham Dawes
2019-02-04 09:48:10 +00:00
committed by Vadim Zeitlin
parent 153b5e85fb
commit 5ec25fe755

View File

@@ -134,7 +134,9 @@ void wxFrame::SetWindowStyleFlag( long style )
{
wxWindow::SetWindowStyleFlag( style );
Qt::WindowFlags qtFlags = GetQMainWindow()->windowFlags();
QMainWindow *qtFrame = GetQMainWindow();
Qt::WindowFlags qtFlags = qtFrame->windowFlags();
qtFlags |= Qt::CustomizeWindowHint;
if ( HasFlag( wxFRAME_TOOL_WINDOW ) )
{
@@ -142,7 +144,47 @@ void wxFrame::SetWindowStyleFlag( long style )
qtFlags |= Qt::Tool;
}
GetQMainWindow()->setWindowFlags( qtFlags );
if ( HasFlag(wxCAPTION) )
{
qtFlags |= Qt::WindowTitleHint;
}
if ( HasFlag(wxSYSTEM_MENU) )
{
qtFlags |= Qt::WindowSystemMenuHint;
}
if ( HasFlag(wxSTAY_ON_TOP) )
{
qtFlags |= Qt::WindowStaysOnTopHint;
}
if ( HasFlag(wxMINIMIZE_BOX) )
{
qtFlags |= Qt::WindowMinimizeButtonHint;
}
if ( HasFlag(wxMAXIMIZE_BOX) )
{
qtFlags |= Qt::WindowMaximizeButtonHint;
}
if ( HasFlag(wxCLOSE_BOX) )
{
qtFlags |= Qt::WindowCloseButtonHint;
}
if ( HasFlag(wxNO_BORDER) )
{
// Note any of the other window decoration hints (e.g.
// Qt::WindowCloseButtonHint, Qt::WindowTitleHint) override this style.
// It doesn't seem possible to create a QMainWindow with a title bar
// but without a resize border.
qtFlags |= Qt::FramelessWindowHint;
}
qtFrame->setWindowFlags(qtFlags);
}
void wxFrame::AddChild( wxWindowBase *child )