on xenial help sign in
Fix issue with initial count for preview
0cb1228Andrea Cimitan
qml/Dash/GenericScopeView.qml+5−4
@@ -85,8 +85,8 @@ FocusScope {
85 } else {
85 } else {
86 subPageLoader.model = resultsModel;
86 subPageLoader.model = resultsModel;
87 }
87 }
88− subPageLoader.currentIndex = -1;
88+ subPageLoader.initialIndex = -1;
89− subPageLoader.currentIndex = index;
89+ subPageLoader.initialIndex = index;
90 subPageLoader.subPage = "preview";
90 subPageLoader.subPage = "preview";
91 subPageLoader.openSubPage();
91 subPageLoader.openSubPage();
92 }
92 }
@@ -466,11 +466,12 @@ FocusScope {
466 property bool open: false
466 property bool open: false
467 property var scope: scopeView.scope
467 property var scope: scopeView.scope
468 property var scopeStyle: scopeView.scopeStyle
468 property var scopeStyle: scopeView.scopeStyle
469− property int currentIndex: -1
469+ property int initialIndex: -1
470 property var model: null
470 property var model: null
471
471
472 readonly property bool processing: status === Loader.Ready && item.hasOwnProperty("processing") ? item.processing : false
472 readonly property bool processing: status === Loader.Ready && item.hasOwnProperty("processing") ? item.processing : false
473 readonly property int count: status === Loader.Ready && item.hasOwnProperty("count") ? item.count : 0
473 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
474 readonly property var currentItem: status === Loader.Ready && item.hasOwnProperty("currentItem") ? item.currentItem : false
475 readonly property var currentItem: status === Loader.Ready && item.hasOwnProperty("currentItem") ? item.currentItem : false
475
476
476 property string subPage: ""
477 property string subPage: ""
@@ -482,7 +483,7 @@ FocusScope {
482 item.scope = Qt.binding(function() { return subPageLoader.scope } )
483 item.scope = Qt.binding(function() { return subPageLoader.scope } )
483 item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle } )
484 item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle } )
484 if (item.hasOwnProperty("open")) item.open = Qt.binding(function() { return subPageLoader.open } )
485 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 } )
486 if (item.hasOwnProperty("model")) item.model = Qt.binding(function() { return subPageLoader.model } )
487 if (item.hasOwnProperty("model")) item.model = Qt.binding(function() { return subPageLoader.model } )
487 }
488 }
488 }
489 }
qml/Dash/PreviewListView.qml+5
@@ -23,6 +23,7 @@ import "Previews" as Previews
23Item {
23Item {
24 id: root
24 id: root
25
25
26+ property int initialIndex: -1
26 property var scope: null
27 property var scope: null
27 property var scopeStyle: null
28 property var scopeStyle: null
28
29
@@ -80,6 +81,10 @@ Item {
80 }
81 }
81 }
82 }
82
83
84+ onCountChanged: {
85+ if (count > 0) currentIndex = initialIndex;
86+ }
87+
83 delegate: Previews.Preview {
88 delegate: Previews.Preview {
84 id: preview
89 id: preview
85 objectName: "preview" + index
90 objectName: "preview" + index
tests/qmltests/Dash/tst_GenericScopeView.qml−1
@@ -410,7 +410,6 @@ Item {
410 verify(background, "Could not find the background");
410 verify(background, "Could not find the background");
411 compare(background.style, data.background);
411 compare(background.style, data.background);
412
412
413− wait(50) // XXX Cimi my machine needs this to pass the following checks
414 var image = findChild(genericScopeView, "titleImage");
413 var image = findChild(genericScopeView, "titleImage");
415 if (data.logo == "") expectFail(data.tag, "Title image should not exist.");
414 if (data.logo == "") expectFail(data.tag, "Title image should not exist.");
416 verify(image, "Could not find the title image.");
415 verify(image, "Could not find the title image.");