on xenial help sign in
Test
aacfcc8Andrea Cimitan
qml/Dash/Dash.qml+23−1
@@ -130,6 +130,7 @@ Showable {
130 UbuntuNumberAnimation {
130 UbuntuNumberAnimation {
131 onRunningChanged: {
131 onRunningChanged: {
132 if (!running && dashContent.x == 0) {
132 if (!running && dashContent.x == 0) {
133+ console.log("close scope", scopeItem.scope)
133 scopeItem.scopeThatOpenedScope.closeScope(scopeItem.scope);
134 scopeItem.scopeThatOpenedScope.closeScope(scopeItem.scope);
134 scopeItem.scope = null;
135 scopeItem.scope = null;
135 }
136 }
@@ -209,6 +210,7 @@ Showable {
209 objectName: "dashTempScopeItem"
210 objectName: "dashTempScopeItem"
210
211
211 property var scopeThatOpenedScope: null
212 property var scopeThatOpenedScope: null
213+ property var oldScope: null
212
214
213 x: dashContent.x + width
215 x: dashContent.x + width
214 y: dashContent.y
216 y: dashContent.y
@@ -222,6 +224,25 @@ Showable {
222 closePreview();
224 closePreview();
223 }
225 }
224
226
227+ Timer {
228+ id: timer
229+ interval: 1000
230+ onTriggered: scopeItem.closeScope()
231+ }
232+
233+ onScopeChanged: {
234+ console.log("scope changed", scope)
235+ timer.start()
236+ }
237+
238+ function closeScope() {
239+ if (oldScope) {
240+ console.log("closing scope, oldscope - current scope", oldScope, scopeItem.scope)
241+ oldScope.closeScope(oldScope);
242+ oldScope = null;
243+ }
244+ }
245+
225 Connections {
246 Connections {
226 target: scopeItem.scope
247 target: scopeItem.scope
227 onGotoScope: {
248 onGotoScope: {
@@ -229,7 +250,8 @@ Showable {
229 }
250 }
230 onOpenScope: {
251 onOpenScope: {
231 scopeItem.closePreview();
252 scopeItem.closePreview();
232− dashContent.openScope(scope);
253+ scopeItem.oldScope = scopeItem.scope;
254+ scopeItem.scope = scope;
233 }
255 }
234 }
256 }
235 }
257 }
tests/qmltests/Dash/tst_Dash.qml+2−1
@@ -475,7 +475,8 @@ Item {
475 tryCompare(subPageLoader, "x", 0);
475 tryCompare(subPageLoader, "x", 0);
476 tryCompare(findChild(dashTempScopeItem, "categoryListView"), "visible", false);
476 tryCompare(findChild(dashTempScopeItem, "categoryListView"), "visible", false);
477
477
478− dashTempScopeItem.scope.openScope(scopes.getScopeFromAll("MockScope7"));
478+ dashTempScopeItem.scope.openScope(scopes.getScopeFromAll("MockScope9"));
479+ dashTempScopeItem.scope.activate();
479 tryCompare(subPageLoader, "open", false);
480 tryCompare(subPageLoader, "open", false);
480
481
481 // Go back
482 // Go back