From f4ffe2a2439928992c3f44085e81686d4f911417 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 27 Feb 2014 12:28:48 +0100 Subject: Enable menuless dialogs on Windows. Handle the flags combination Qt::Dialog && !Qt::WindowSystemMenuHint such that it results in exStyle = WS_EX_DLGMODALFRAME and style = WS_POPUP | WS_BORDER | WS_SYSMENU and a window class without icon. Do not set !Qt::WindowSystemMenuHint in QWidgetPrivate::adjustFlags() for dialogs on Windows. [ChangeLog][QtWidgets][QDialog][Windows] Dialogs can now be menuless. Task-number: QTBUG-2027 Change-Id: Ieb86985e8a5291d826c103fe478ecde43971f08e Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d77f587b92..223ac9ac2d 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -110,6 +110,8 @@ static QByteArray debugWinExStyle(DWORD exStyle) rc += " WS_EX_CONTEXTHELP"; if (exStyle & WS_EX_LAYERED) rc += " WS_EX_LAYERED"; + if (exStyle & WS_EX_DLGMODALFRAME) + rc += " WS_EX_DLGMODALFRAME"; return rc; } @@ -513,6 +515,10 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag } if (flags & Qt::WindowSystemMenuHint) style |= WS_SYSMENU; + else if (dialog) { + style |= WS_SYSMENU | WS_BORDER; // QTBUG-2027, dialogs without system menu. + exStyle |= WS_EX_DLGMODALFRAME; + } if (flags & Qt::WindowMinimizeButtonHint) style |= WS_MINIMIZEBOX; if (shouldShowMaximizeButton(w, flags)) -- cgit v1.2.3