diff options
author | Robert Griebl <robert.griebl@pelagicore.com> | 2016-04-14 17:49:11 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2016-04-18 19:26:25 +0000 |
commit | 50a1cd3aac4a6e04cb4931f20996c353318fed03 (patch) | |
tree | 648b704a8a5a4c6092ee868e06f2b9c9b5acfa85 /tests/auto/quick/qquickwindow/data | |
parent | 6753b1c84219d1e615bda8515332b187f21ca094 (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 'tests/auto/quick/qquickwindow/data')
-rw-r--r-- | tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml b/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml new file mode 100644 index 0000000000..48c4d1d69f --- /dev/null +++ b/tests/auto/quick/qquickwindow/data/changeVisibilityInCompleted.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 +import QtQuick.Window 2.1 + +Window { + width: 200 + height: 200 + + property var winVisible: subwin1 + property var winVisibility: subwin2 + + Rectangle { + anchors.fill: parent + color:"green" + } + + Window { + id: subwin1 + width: 200 + height: 200 + + visible: false + + Rectangle { + anchors.fill: parent + color:"red" + } + Component.onCompleted: { + subwin1.visible = true + } + } + Window { + id: subwin2 + width: 200 + height: 200 + + visible: true + visibility: Window.Maximized + + Rectangle { + anchors.fill: parent + color:"blue" + } + Component.onCompleted: { + subwin2.visibility = Window.Windowed + } + } +} |