Disable maximize button for fixed-size windows.

Task-number: QTBUG-28407

Change-Id: I5bab7fcf4ad3ecc7008ef02b9d3575d75893895d
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
This commit is contained in:
Friedemann Kleint 2013-02-26 16:20:43 +01:00 committed by The Qt Project
parent 7867f03f8a
commit e265a1a4bd

View File

@ -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;