diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-10-16 15:28:31 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-10-26 14:53:40 +0000 |
commit | ac27f9a83e916431fc378d99959187d339af4639 (patch) | |
tree | 135cd0f06e7fb076fba8a2edce4ffcb9e908dd26 /src/gui/kernel/qwindow.cpp | |
parent | 2f402e4d099c0175cf79e95b624dedad7384062d (diff) |
Ensure QWindow::setParent() creates parent hierarchy if needed
If the QWindow has been created and has a platform window, we need to
ensure that the windows in the parent hierarchy also are created before
we set a new parent on the platform window, otherwise the platform window
will think that it's a top level window.
Change-Id: Icb2c3cd5411cd1eb595e8673e144095feda31df9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index ec2e3e7367..f55e7f0803 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -612,20 +612,19 @@ void QWindow::setParent(QWindow *parent) } QObject::setParent(parent); + d->parentWindow = parent; + if (parent) d->disconnectFromScreen(); else d->connectToScreen(newScreen); if (d->platformWindow) { - if (parent && parent->d_func()->platformWindow) { - d->platformWindow->setParent(parent->d_func()->platformWindow); - } else { - d->platformWindow->setParent(0); - } - } + if (parent) + parent->create(); - d->parentWindow = parent; + d->platformWindow->setParent(parent ? parent->d_func()->platformWindow : 0); + } QGuiApplicationPrivate::updateBlockedStatus(this); } |