diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-09 13:47:41 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-10 12:17:05 +0000 |
commit | 3b30353e4be87ca62fb145fc77a11a4a06af27e5 (patch) | |
tree | f724708f9bfb0c83fcf52cee2a23d76fc7230a51 /src/libs | |
parent | fb1ddb53c8301bd081fddbb7429adc03db4d1c95 (diff) | |
download | qt-creator-3b30353e4be87ca62fb145fc77a11a4a06af27e5.tar.gz |
Tracing: Update selection range when timeline width changes
The viewTimePerPixel needs to be adapted then.
Change-Id: Ie057c780cc75099f1b9df18c79c5e133411ef8e6
Fixes: QTCREATORBUG-22094
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/tracing/qml/MainView.qml | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/libs/tracing/qml/MainView.qml b/src/libs/tracing/qml/MainView.qml index 03e3fceead..2e1f97a3ba 100644 --- a/src/libs/tracing/qml/MainView.qml +++ b/src/libs/tracing/qml/MainView.qml @@ -55,19 +55,7 @@ Rectangle { onRangeChanged: { zoomSliderToolBar.updateZoomLevel(); content.scroll(); - - // If you select something in the main view and then resize the current range by some - // other means, the selection should stay where it was. - var oldTimePerPixel = selectionRange.viewTimePerPixel; - selectionRange.viewTimePerPixel = zoomControl.rangeDuration / content.width; - if (selectionRange.creationState === selectionRange.creationFinished && - oldTimePerPixel != selectionRange.viewTimePerPixel) { - var newWidth = selectionRange.rangeWidth * oldTimePerPixel / - selectionRange.viewTimePerPixel; - selectionRange.rangeLeft = selectionRange.rangeLeft * oldTimePerPixel / - selectionRange.viewTimePerPixel; - selectionRange.rangeRight = selectionRange.rangeLeft + newWidth; - } + selectionRange.update(); } onWindowChanged: { content.scroll(); @@ -216,6 +204,8 @@ Rectangle { buttonsBar.updateLockButton(selectionLocked); } + onWidthChanged: selectionRange.update(); + onPropagateSelection: { if (lockItemSelection || (newModel === selectedModel && newItem === selectedItem)) return; @@ -314,6 +304,18 @@ Rectangle { root.selectionRangeMode = false; } + function update() { + // If you select something in the main view and then resize the current range by some + // other means, the selection should stay where it was. + var oldTimePerPixel = viewTimePerPixel; + viewTimePerPixel = zoomControl.rangeDuration / content.width; + if (creationState === creationFinished && oldTimePerPixel != viewTimePerPixel) { + var newWidth = rangeWidth * oldTimePerPixel / viewTimePerPixel; + rangeLeft = rangeLeft * oldTimePerPixel / viewTimePerPixel; + rangeRight = rangeLeft + newWidth; + } + } + } } |