on xenial help sign in
[panel] Let qt handle calculation of contentX to avoid race condition

This removes the manual calculation of contentX to avoid race condition that happen where both us and qt wants to set contentX, this ended up in a wierd state where it calculated wrong pos for the panel content. Also as qt states in the docs, we should NOT set contentX ourself: https://doc.qt.io/qt-5/qml-qtquick-listview.html#positionViewAtIndex-method This fixes: https://github.com/ubports/unity8/issues/157

commit4e980e19dc400287411e7d239a7727806a404efb authorMarius Gripsgard <marius@ubports.com> dateSat 29 Jun 2019, 01:26 (7 years ago) parent305605c
1 file changed+4−1
qml/Panel/MenuContent.qml+4−1
qml/Panel/MenuContent.qml+4−1
@@ -45,7 +45,6 @@ Rectangle {
4545 model: content.model
4646
4747 highlightFollowsCurrentItem: false
48− contentX: currentIndex * width
4948 interactive: false
5049 orientation: ListView.Horizontal
5150 // Load all the indicator menus (a big number)
@@ -56,6 +55,10 @@ Rectangle {
5655 listViewContent.currentIndex = content.currentMenuIndex;
5756 }
5857
58+ onCurrentIndexChanged: {
59+ positionViewAtIndex(currentIndex, ListView.Beginning);
60+ }
61+
5962 delegate: Loader {
6063 id: loader
6164