summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2016-06-08 14:00:14 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2016-06-09 09:25:37 +0000
commit40b3ee57e385ca636f90c59604fa4f3692a08edc (patch)
tree6e32ccb935de6219b966bb108137e01e0feef61d
parent7e33119c487b6ce7ee1b7e8fc7b9b862adba1c91 (diff)
downloadqtquickcontrols-40b3ee57e385ca636f90c59604fa4f3692a08edc.tar.gz
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 <gabriel.dedietrich@qt.io>
-rw-r--r--src/controls/Private/ScrollViewHelper.qml2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/controls/Private/ScrollViewHelper.qml b/src/controls/Private/ScrollViewHelper.qml
index 03ca30c8..b4a589bf 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
}
}