From e265a1a4bd5e161344babe51be424c7e9d561411 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Feb 2013 16:20:43 +0100 Subject: Disable maximize button for fixed-size windows. Task-number: QTBUG-28407 Change-Id: I5bab7fcf4ad3ecc7008ef02b9d3575d75893895d Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 20000ea0a9..7a68cdeb47 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -203,17 +203,16 @@ static inline QSize clientSize(HWND hwnd) return qSizeOfRect(rect); } -// from qwidget_win.cpp/maximum layout size check removed. -static bool shouldShowMaximizeButton(Qt::WindowFlags flags) +// from qwidget_win.cpp +static bool shouldShowMaximizeButton(const QWindow *w) { - if (flags & Qt::MSWindowsFixedSizeDialogHint) + const Qt::WindowFlags flags = w->flags(); + if ((flags & Qt::MSWindowsFixedSizeDialogHint) || !(flags & Qt::WindowMaximizeButtonHint)) return false; // if the user explicitly asked for the maximize button, we try to add // it even if the window has fixed size. - if (flags & Qt::CustomizeWindowHint && - flags & Qt::WindowMaximizeButtonHint) - return true; - return flags & Qt::WindowMaximizeButtonHint; + return (flags & Qt::CustomizeWindowHint) || + w->maximumSize() == QSize(QWINDOWSIZE_MAX, QWINDOWSIZE_MAX); } // Set the WS_EX_LAYERED flag on a HWND if required. This is required for @@ -432,7 +431,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag style |= WS_SYSMENU; if (flags & Qt::WindowMinimizeButtonHint) style |= WS_MINIMIZEBOX; - if (shouldShowMaximizeButton(flags)) + if (shouldShowMaximizeButton(w)) style |= WS_MAXIMIZEBOX; if (tool) exStyle |= WS_EX_TOOLWINDOW; -- cgit v1.2.3