on xenial help sign in
Workaround bug when moving to/from the current index scope
commit49f86d59a8323abd911f603877ed811ab2a5488b authorAlbert Astals <albert.astals@canonical.com> dateWed 22 Oct 2014, 09:51 (12 years ago) parentc25e708
2 files changed+21−1
qml/Dash/Dash.qml+10 qml/Dash/DashContent.qml+11−1
qml/Dash/Dash.qml+10
@@ -90,6 +90,16 @@ Showable {
9090 id: progressAnimation
9191 UbuntuNumberAnimation { }
9292 }
93+
94+ onProgressChanged: {
95+ // FIXME This is to workaround a Qt bug with the model moving the current item
96+ // when the list is ListView.SnapOneItem and ListView.StrictlyEnforceRange
97+ // together with the code in DashContent.qml
98+ if (dashContent.workaroundRestoreIndex != -1) {
99+ dashContent.currentIndex = dashContent.workaroundRestoreIndex;
100+ dashContent.workaroundRestoreIndex = -1;
101+ }
102+ }
93103 }
94104
95105 DashContent {
qml/Dash/DashContent.qml+11−1
@@ -26,7 +26,8 @@ Item {
2626
2727 property bool forceNonInteractive: false
2828 property alias scopes: dashContentList.model
29− readonly property alias currentIndex: dashContentList.currentIndex
29+ property alias currentIndex: dashContentList.currentIndex
30+ property int workaroundRestoreIndex: -1
3031 readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : ""
3132 readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
3233 readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ?
@@ -52,6 +53,15 @@ Item {
5253 set_current_index = undefined;
5354 }
5455 }
56+ onRowsMoved: {
57+ // FIXME This is to workaround a Qt bug with the model moving the current item
58+ // when the list is ListView.SnapOneItem and ListView.StrictlyEnforceRange
59+ // together with the code in Dash.qml
60+ if (row == dashContentList.currentIndex || start == dashContentList.currentIndex) {
61+ dashContent.workaroundRestoreIndex = dashContentList.currentIndex;
62+ dashContentList.currentIndex = -1;
63+ }
64+ }
5565 }
5666
5767 Connections {