Commit ca3881d3 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

Timeline: Update overview range mover when width changes



Change-Id: I231eb8fae65e84007a1678070429414b0f98d396
Task-number: QTCREATORBUG-15441
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
parent e4be9edc
......@@ -39,8 +39,9 @@ Rectangle {
property QtObject modelProxy
property QtObject zoomer
property bool recursionGuard: false
onWidthChanged: updateRangeMover()
function updateRange() {
function updateZoomer() {
if (recursionGuard)
return;
recursionGuard = true;
......@@ -53,24 +54,26 @@ Rectangle {
recursionGuard = false;
}
function updateRangeMover() {
if (recursionGuard)
return;
recursionGuard = true;
var newRangeX = (zoomer.rangeStart - zoomer.traceStart) * width /
zoomer.traceDuration;
var newWidth = zoomer.rangeDuration * width / zoomer.traceDuration;
var widthChanged = Math.abs(newWidth - rangeMover.rangeWidth) > 1;
var leftChanged = Math.abs(newRangeX - rangeMover.rangeLeft) > 1;
if (leftChanged)
rangeMover.rangeLeft = newRangeX;
if (leftChanged || widthChanged)
rangeMover.rangeRight = newRangeX + newWidth;
recursionGuard = false;
}
Connections {
target: zoomer
onRangeChanged: {
if (recursionGuard)
return;
recursionGuard = true;
var newRangeX = (zoomer.rangeStart - zoomer.traceStart) * width /
zoomer.traceDuration;
var newWidth = zoomer.rangeDuration * width / zoomer.traceDuration;
var widthChanged = Math.abs(newWidth - rangeMover.rangeWidth) > 1;
var leftChanged = Math.abs(newRangeX - rangeMover.rangeLeft) > 1;
if (leftChanged)
rangeMover.rangeLeft = newRangeX;
if (leftChanged || widthChanged)
rangeMover.rangeRight = newRangeX + newWidth;
recursionGuard = false;
}
onRangeChanged: updateRangeMover()
}
TimeDisplay {
......@@ -185,8 +188,8 @@ Rectangle {
RangeMover {
id: rangeMover
visible: modelProxy.height > 0
onRangeLeftChanged: overview.updateRange()
onRangeRightChanged: overview.updateRange()
onRangeLeftChanged: overview.updateZoomer()
onRangeRightChanged: overview.updateZoomer()
}
Rectangle {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment