Set currentIndex after the model change is completed
When setting the model, the list view will first emit the countChanged signal,
then will cahnge the currentIndex to 0 (see QtDeclarative git commit 22c6873
and https://bugreports.qt.io/browse/QTBUG-26604), and finally will emit the
modelChanged signal.
If we set the currentIndex in the onCountChanged handler (as we were doing
before), the currentIndex would be reset to 0 shortly afterwards.
commita5a98eddf07da36ce7542fa829391b4f77940f57
authorAlberto Mardegan <alberto.mardegan@canonical.com>
dateFri 14 Aug 2015, 15:20 (11 years ago)
parentdda4169
qml/Dash/PreviewListView.qml+1−1
@@ -84,7 +84,7 @@ Item {
8484 }
8585 }
8686
87− onCountChanged: {
87+ onModelChanged: {
8888 if (count > 0 && initialIndex >= 0) {
8989 currentIndex = initialIndex;
9090 initialIndex = -1;