aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickwindowmodule.cpp
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@pelagicore.com>2016-04-14 17:49:11 +0200
committerRobert Griebl <robert.griebl@pelagicore.com>2016-04-18 19:26:25 +0000
commit50a1cd3aac4a6e04cb4931f20996c353318fed03 (patch)
tree648b704a8a5a4c6092ee868e06f2b9c9b5acfa85 /src/quick/items/qquickwindowmodule.cpp
parent6753b1c84219d1e615bda8515332b187f21ca094 (diff)
Fix changing QML Window visibility in Component.onCompleted
Creating a transient QML Window with visible set to false and then trying to show() it in Component.onCompleted led to a race condition where the window would be shown for a brief moment and then hidden again to enforce the delayed initialization of the visible property. Fixed by tracking the value of the visible property regardless of the 'completed' state. The same problem was fixed for the visibility property. Task-number: QTBUG-52573 Change-Id: I2a2ed7f359b951cb9189a7a6628d1d0cc1445d73 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/quick/items/qquickwindowmodule.cpp')
-rw-r--r--src/quick/items/qquickwindowmodule.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index 124df8f676..c624d162a9 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -77,18 +77,16 @@ QQuickWindowQmlImpl::QQuickWindowQmlImpl(QWindow *parent)
void QQuickWindowQmlImpl::setVisible(bool visible)
{
Q_D(QQuickWindowQmlImpl);
- if (!d->complete)
- d->visible = visible;
- else if (!transientParent() || transientParent()->isVisible())
+ d->visible = visible;
+ if (d->complete && (!transientParent() || transientParent()->isVisible()))
QQuickWindow::setVisible(visible);
}
void QQuickWindowQmlImpl::setVisibility(Visibility visibility)
{
Q_D(QQuickWindowQmlImpl);
- if (!d->complete)
- d->visibility = visibility;
- else
+ d->visibility = visibility;
+ if (d->complete)
QQuickWindow::setVisibility(visibility);
}