on xenial help sign in
Workaround bug when moving to/from the current index scope
49f86d5Albert Astals
qml/Dash/Dash.qml+10
@@ -90,6 +90,16 @@ Showable {
90 id: progressAnimation
90 id: progressAnimation
91 UbuntuNumberAnimation { }
91 UbuntuNumberAnimation { }
92 }
92 }
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+ }
93 }
103 }
94
104
95 DashContent {
105 DashContent {
qml/Dash/DashContent.qml+11−1
@@ -26,7 +26,8 @@ Item {
26
26
27 property bool forceNonInteractive: false
27 property bool forceNonInteractive: false
28 property alias scopes: dashContentList.model
28 property alias scopes: dashContentList.model
29− readonly property alias currentIndex: dashContentList.currentIndex
29+ property alias currentIndex: dashContentList.currentIndex
30+ property int workaroundRestoreIndex: -1
30 readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : ""
31 readonly property string currentScopeId: dashContentList.currentItem ? dashContentList.currentItem.scopeId : ""
31 readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
32 readonly property var currentScope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
32 readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ?
33 readonly property bool subPageShown: dashContentList.currentItem && dashContentList.currentItem.item ?
@@ -52,6 +53,15 @@ Item {
52 set_current_index = undefined;
53 set_current_index = undefined;
53 }
54 }
54 }
55 }
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+ }
55 }
65 }
56
66
57 Connections {
67 Connections {