diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-03-29 14:12:41 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-03-29 12:19:31 +0000 |
commit | 749b5a5098160e77d621142a6fa95b301b5a1b0b (patch) | |
tree | e10aeb4a3e9b32d739050529d42989ac3e64f64c /src | |
parent | 186f0f574af5e633d618c401155129b6823902da (diff) | |
download | qt-creator-749b5a5098160e77d621142a6fa95b301b5a1b0b.tar.gz |
Timeline: Use ScrollView's rather than Flickable's width for scrolling
The Flickable's width does not include the scrollbar, which may appear
and disappear, depending on contentWidth, and confuse the timestamp
calculations.
Change-Id: I6d516e6149ee64a129a1393a0780734484354147
Task-number: QTCREATORBUG-17940
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/timeline/qml/TimelineContent.qml | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libs/timeline/qml/TimelineContent.qml b/src/libs/timeline/qml/TimelineContent.qml index 74a929769a..aae9b12229 100644 --- a/src/libs/timeline/qml/TimelineContent.qml +++ b/src/libs/timeline/qml/TimelineContent.qml @@ -68,6 +68,7 @@ ScrollView { // switch to non-interactive ourselves, though. property bool stayInteractive: true onStayInteractiveChanged: flick.interactive = stayInteractive + onWidthChanged: scroll() Flickable { id: flick @@ -88,13 +89,12 @@ ScrollView { recursionGuard = false; } - onWidthChanged: scroll() - // Update the zoom control on scrolling. onContentXChanged: guarded(function() { - var newStartTime = contentX * zoomer.rangeDuration / width + zoomer.windowStart; + var newStartTime = contentX * zoomer.rangeDuration / scroller.width + + zoomer.windowStart; if (isFinite(newStartTime) && Math.abs(newStartTime - zoomer.rangeStart) >= 1) { - var newEndTime = (contentX + width) * zoomer.rangeDuration / width + var newEndTime = (contentX + scroller.width) * zoomer.rangeDuration / scroller.width + zoomer.windowStart; if (isFinite(newEndTime)) zoomer.setRange(newStartTime, newEndTime); @@ -108,10 +108,10 @@ ScrollView { contentWidth = 0; contentX = 0; } else { - var newWidth = zoomer.windowDuration * width / zoomer.rangeDuration; + var newWidth = zoomer.windowDuration * scroller.width / zoomer.rangeDuration; if (isFinite(newWidth) && Math.abs(newWidth - contentWidth) >= 1) contentWidth = newWidth; - var newStartX = (zoomer.rangeStart - zoomer.windowStart) * width / + var newStartX = (zoomer.rangeStart - zoomer.windowStart) * scroller.width / zoomer.rangeDuration; if (isFinite(newStartX) && Math.abs(newStartX - contentX) >= 1) contentX = newStartX; |