diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-05-23 12:00:58 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-23 16:21:43 +0200 |
commit | 26ae24e20b47d327508cae77751f677248cb4a32 (patch) | |
tree | fbe3f05f4e3e447c90af61d8d911e315ffe1a856 /src | |
parent | de098e21d1f0c533fcace11368d5c76217eb0f56 (diff) |
Windows: Fix toplevel window flags for Qt::Dialogs/Qt::Tool.
Task-number: QTBUG-31111
Change-Id: I58dcf8101077f18c7867cae914026c692735fc15
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 403d709dba..73c78f0090 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -332,6 +332,25 @@ QDebug operator<<(QDebug debug, const WindowCreationData &d) return debug; } +// Fix top level window flags in case only the type flags are passed. +static inline void fixTopLevelWindowFlags(Qt::WindowFlags &flags) +{ + switch (flags) { + case Qt::Window: + flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint + |Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint; + break; + case Qt::Dialog: + flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint; + break; + case Qt::Tool: + flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; + break; + default: + break; + } +} + void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flagsIn, unsigned creationFlags) { @@ -358,10 +377,8 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag topLevel = (creationFlags & ForceTopLevel) ? true : w->isTopLevel(); } - if (topLevel && flags == 1) { - flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint - |Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint; - } + if (topLevel) + fixTopLevelWindowFlags(flags); type = static_cast<Qt::WindowType>(int(flags) & Qt::WindowType_Mask); switch (type) { |