From 0f327270971f06d3b41b387f8c4c16d001bb610c Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 31 Jan 2018 14:08:39 +0100 Subject: Timeline: Bind to Flickable's width for scrolling The setup of ScrollView and Flickable will otherwise generate a spurious contentX change that messes up our range position. Change-Id: I04f41b206a7ef4f0a889448f36103f427d1330d7 Task-number: QTCREATORBUG-19656 Reviewed-by: Robert Loehning --- src/libs/timeline/qml/TimelineContent.qml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libs/timeline/qml/TimelineContent.qml b/src/libs/timeline/qml/TimelineContent.qml index aae9b12229..cc5a1a7995 100644 --- a/src/libs/timeline/qml/TimelineContent.qml +++ b/src/libs/timeline/qml/TimelineContent.qml @@ -68,7 +68,6 @@ ScrollView { // switch to non-interactive ourselves, though. property bool stayInteractive: true onStayInteractiveChanged: flick.interactive = stayInteractive - onWidthChanged: scroll() Flickable { id: flick @@ -89,6 +88,15 @@ ScrollView { recursionGuard = false; } + // Logically we should bind to scroller.width above as we use scroller.width in scroll(). + // However, this width changes before scroller.width when the window is resized and if we + // don't explicitly set contentX here, for some reason an automatic change in contentX is + // triggered after this width has changed, but before scroller.width changes. This would be + // indistinguishabe from a manual flick by the user and thus changes the range position. We + // don't want to change the range position on resizing the window. Therefore we bind to this + // width. + onWidthChanged: scroll() + // Update the zoom control on scrolling. onContentXChanged: guarded(function() { var newStartTime = contentX * zoomer.rangeDuration / scroller.width -- cgit v1.2.3