on xenial help sign in
Make it work the second time
f47d0f3Albert Astals Cid
qml/Components/Dialogs.qml+2−1
@@ -151,11 +151,12 @@ MouseArea {
151 active: false
151 active: false
152 onActiveChanged: {
152 onActiveChanged: {
153 if (!active) {
153 if (!active) {
154− previousSourceComponent = undefined;
155 if (previousFocusedItem) {
154 if (previousFocusedItem) {
156 previousFocusedItem.forceActiveFocus(Qt.OtherFocusReason);
155 previousFocusedItem.forceActiveFocus(Qt.OtherFocusReason);
157 previousFocusedItem = undefined;
156 previousFocusedItem = undefined;
158 }
157 }
158+ previousSourceComponent = undefined;
159+ sourceComponent = undefined;
159 }
160 }
160 }
161 }
161 onSourceComponentChanged: {
162 onSourceComponentChanged: {
tests/qmltests/tst_OrientedShell.qml+10
@@ -1620,6 +1620,16 @@ Rectangle {
1620
1620
1621 tryCompare(dialogLoader, "item", null);
1621 tryCompare(dialogLoader, "item", null);
1622 compare(window.activeFocusItem, surfaceItem);
1622 compare(window.activeFocusItem, surfaceItem);
1623+
1624+ // Do it twice, our previous solution failed the second time ^_^
1625+ testCase.showPowerDialog();
1626+
1627+ tryCompareFunction(function() { return dialogLoader.item !== null }, true);
1628+
1629+ keyClick(Qt.Key_Escape);
1630+
1631+ tryCompare(dialogLoader, "item", null);
1632+ compare(window.activeFocusItem, surfaceItem);
1623 }
1633 }
1624 }
1634 }
1625}
1635}