on xenial help sign in
Fix issue with initial count for preview
commit0cb1228d6628e67b083ed842f1b5f7815ae348a8 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateFri 15 Aug 2014, 17:42 (12 years ago) parent806f2d0
3 files changed+10−5
qml/Dash/GenericScopeView.qml+5−4 qml/Dash/PreviewListView.qml+5 tests/qmltests/Dash/tst_GenericScopeView.qml−1
qml/Dash/GenericScopeView.qml+5−4
@@ -85,8 +85,8 @@ FocusScope {
8585 } else {
8686 subPageLoader.model = resultsModel;
8787 }
88− subPageLoader.currentIndex = -1;
89− subPageLoader.currentIndex = index;
88+ subPageLoader.initialIndex = -1;
89+ subPageLoader.initialIndex = index;
9090 subPageLoader.subPage = "preview";
9191 subPageLoader.openSubPage();
9292 }
@@ -466,11 +466,12 @@ FocusScope {
466466 property bool open: false
467467 property var scope: scopeView.scope
468468 property var scopeStyle: scopeView.scopeStyle
469− property int currentIndex: -1
469+ property int initialIndex: -1
470470 property var model: null
471471
472472 readonly property bool processing: status === Loader.Ready && item.hasOwnProperty("processing") ? item.processing : false
473473 readonly property int count: status === Loader.Ready && item.hasOwnProperty("count") ? item.count : 0
474+ readonly property int currentIndex: status === Loader.Ready && item.hasOwnProperty("currentIndex") ? item.currentIndex : false
474475 readonly property var currentItem: status === Loader.Ready && item.hasOwnProperty("currentItem") ? item.currentItem : false
475476
476477 property string subPage: ""
@@ -482,7 +483,7 @@ FocusScope {
482483 item.scope = Qt.binding(function() { return subPageLoader.scope } )
483484 item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle } )
484485 if (item.hasOwnProperty("open")) item.open = Qt.binding(function() { return subPageLoader.open } )
485− if (item.hasOwnProperty("currentIndex")) item.currentIndex = Qt.binding(function() { return subPageLoader.currentIndex } )
486+ if (item.hasOwnProperty("initialIndex")) item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex } )
486487 if (item.hasOwnProperty("model")) item.model = Qt.binding(function() { return subPageLoader.model } )
487488 }
488489 }
qml/Dash/PreviewListView.qml+5
@@ -23,6 +23,7 @@ import "Previews" as Previews
2323Item {
2424 id: root
2525
26+ property int initialIndex: -1
2627 property var scope: null
2728 property var scopeStyle: null
2829
@@ -80,6 +81,10 @@ Item {
8081 }
8182 }
8283
84+ onCountChanged: {
85+ if (count > 0) currentIndex = initialIndex;
86+ }
87+
8388 delegate: Previews.Preview {
8489 id: preview
8590 objectName: "preview" + index
tests/qmltests/Dash/tst_GenericScopeView.qml−1
@@ -410,7 +410,6 @@ Item {
410410 verify(background, "Could not find the background");
411411 compare(background.style, data.background);
412412
413− wait(50) // XXX Cimi my machine needs this to pass the following checks
414413 var image = findChild(genericScopeView, "titleImage");
415414 if (data.logo == "") expectFail(data.tag, "Title image should not exist.");
416415 verify(image, "Could not find the title image.");