summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-01-14 15:42:33 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-15 13:38:55 +0100
commitcd7ba89a07f794b17fc66ba29515b104c4d21f27 (patch)
tree34e2d9da141ddce310cabc5f8ea362b33fd4f74e /src/plugins
parent71a7ad80c0fd908fd743ff1f4919a72997568e3e (diff)
Windows: Force toplevel flag in setParent() in both cases.
When re-applying window flags in setParent, force top level on or off according to state. Task-number: QTBUG-28872 Change-Id: If931fcb38394f472a6cdf260aa935c1d03779611 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 3831c6b10e..9360ba6460 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -267,7 +267,7 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level)
struct WindowCreationData
{
typedef QWindowsWindow::WindowData WindowData;
- enum Flags { ForceChild = 0x1 };
+ enum Flags { ForceChild = 0x1, ForceTopLevel = 0x2 };
WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0),
topLevel(false), popup(false), dialog(false), desktop(false),
@@ -319,7 +319,13 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
parentHandle = (HWND)prop.value<WId>();
}
- topLevel = ((creationFlags & ForceChild) || embedded) ? false : w->isTopLevel();
+ if (creationFlags & ForceChild) {
+ topLevel = false;
+ } else if (creationFlags & ForceTopLevel) {
+ topLevel = true;
+ } else {
+ topLevel = w->isTopLevel();
+ }
if (topLevel && flags == 1) {
flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint
@@ -984,10 +990,9 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const
// WS_CHILD/WS_POPUP must be manually set/cleared in addition
// to dialog frames, etc (see SetParent() ) if the top level state changes.
- if (wasTopLevel != isTopLevel) {
- const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild);
- setWindowFlags_sys(window()->flags(), flags);
- }
+ // Force toplevel state as QWindow::isTopLevel cannot be relied upon here.
+ if (wasTopLevel != isTopLevel)
+ setWindowFlags_sys(window()->flags(), unsigned(isTopLevel ? WindowCreationData::ForceTopLevel : WindowCreationData::ForceChild));
}
}