aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-01-31 14:08:39 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-02-01 11:13:32 +0000
commit0f327270971f06d3b41b387f8c4c16d001bb610c (patch)
treed5a24fb65e6eea82fca28251c0562b86ae8a8426
parente43668f603f25e372dfdf3e9070bbc2d7db147f3 (diff)
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 <robert.loehning@qt.io>
-rw-r--r--src/libs/timeline/qml/TimelineContent.qml10
1 files changed, 9 insertions, 1 deletions
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