From 50a1cd3aac4a6e04cb4931f20996c353318fed03 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 14 Apr 2016 17:49:11 +0200 Subject: 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 --- src/quick/items/qquickwindowmodule.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/quick/items') 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); } -- cgit v1.2.3