From 40b3ee57e385ca636f90c59604fa4f3692a08edc Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Jun 2016 14:00:14 +0200 Subject: ScrollView: block updates when redoing the layout Changing the contentHeight might change the maximum value of the scrollbar which might change the value of the scrollbar which, if blockUpdates is not set, will change the contentY of the flickable. This can cause flickering when contentHeight varries with contentY which might typically happen for a ListView where not all elements have the same height. Or worse, this can make the scrolling jump and result in the wrong position. Change-Id: I1968055492d679387ebbf6813a160efbf82e4fbb Reviewed-by: Gabriel de Dietrich --- src/controls/Private/ScrollViewHelper.qml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/controls/Private/ScrollViewHelper.qml') diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml index 03ca30c87..b4a589bf7 100644 --- a/src/controls/Private/ScrollViewHelper.qml +++ b/src/controls/Private/ScrollViewHelper.qml @@ -70,10 +70,12 @@ Item { function doLayout() { if (!recursionGuard) { recursionGuard = true + blockUpdates = true; scrollHelper.contentWidth = flickableItem !== null ? flickableItem.contentWidth : 0 scrollHelper.contentHeight = flickableItem !== null ? flickableItem.contentHeight : 0 scrollHelper.availableWidth = viewport.width scrollHelper.availableHeight = viewport.height + blockUpdates = false; recursionGuard = false } } -- cgit v1.2.3