on xenial help sign in
setting the launcher's extensionSize delayed to position the view correctly at the beginning
e0b237aMichael Zanetti
Launcher/LauncherPanel.qml+14−1
@@ -110,7 +110,20 @@ Item {
110 // destroyed when dragging them outside the list. This needs to be at least
110 // destroyed when dragging them outside the list. This needs to be at least
111 // itemHeight to prevent folded items from disappearing and DragArea limits
111 // itemHeight to prevent folded items from disappearing and DragArea limits
112 // need to be smaller than this size to avoid breakage.
112 // need to be smaller than this size to avoid breakage.
113− property int extensionSize: itemHeight * 3
113+ property int extensionSize: 0
114+
115+ // Setting extensionSize after the list has been populated because it has
116+ // the potential to mess up with the intial positioning in combination
117+ // with snapping to the center of the list. This catches all the cases
118+ // where the item would be outside the list for more than itemHeight / 2.
119+ // For the rest, give it a flick to scroll to the beginning. Note that
120+ // the flicking alone isn't enough because in some cases it's not strong
121+ // enough to overcome the snapping.
122+ // https://bugreports.qt-project.org/browse/QTBUG-32251
123+ Component.onCompleted: {
124+ extensionSize = itemHeight * 3
125+ flick(0, clickFlickSpeed)
126+ }
114
127
115 // The height of the area where icons start getting folded
128 // The height of the area where icons start getting folded
116 property int foldingStartHeight: units.gu(6.5)
129 property int foldingStartHeight: units.gu(6.5)
tests/qmltests/Launcher/tst_Launcher.qml+4−6
@@ -249,11 +249,10 @@ Item {
249 name: "LauncherInit"
249 name: "LauncherInit"
250 when: windowShown
250 when: windowShown
251
251
252− /*
252+ function initTestCase() {
253− * FIXME: There is a bug in ListView which makes it snap to an item
253+ var listView = findChild(launcher, "launcherListView");
254− * instead of the edge at startup. Enable this test once our patch for
254+ tryCompare(listView, "flicking", false)
255− * ListView has landed upstream.
255+ }
256− * https://bugreports.qt-project.org/browse/QTBUG-32251
257
256
258 function test_initFirstUnfolded() {
257 function test_initFirstUnfolded() {
259
258
@@ -267,7 +266,6 @@ Item {
267 // Now do check that snapping is in fact enabled
266 // Now do check that snapping is in fact enabled
268 compare(listView.snapMode, ListView.SnapToItem, "Snapping is not enabled");
267 compare(listView.snapMode, ListView.SnapToItem, "Snapping is not enabled");
269 }
268 }
270− */
271 }
269 }
272
270
273 UT.UnityTestCase {
271 UT.UnityTestCase {