Commit 2f8f5191 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: improve selection behavior in timeline



When selecting ranges in the timeline the selector would sometimes hang
or behave weirdly when moving back. This was due to incorrect logic in
the selection bounds calculation and because the vertical flicking would
steal mouse events.

Change-Id: I14074463422d1d9a0aa8ecd1f88847e7330c9b6b
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
Reviewed-by: default avatarUlf Hermann <ulf.hermann@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 0489adf0
......@@ -309,8 +309,11 @@ Rectangle {
boundsBehavior: Flickable.StopAtBounds
// ScrollView will try to deinteractivate it. We don't want that
// as the horizontal flickable is interactive, too.
onInteractiveChanged: interactive = true
// as the horizontal flickable is interactive, too. We do occasionally
// switch to non-interactive ourselves, though.
property bool stayInteractive: true
onInteractiveChanged: interactive = stayInteractive
onStayInteractiveChanged: interactive = stayInteractive
// ***** child items
TimeMarks {
......@@ -429,6 +432,9 @@ Rectangle {
onPressed: {
selectionRange.pressedOnCreation();
}
onCanceled: {
selectionRange.releasedOnCreation();
}
onPositionChanged: {
selectionRange.movedOnCreation();
}
......
......@@ -42,6 +42,7 @@ RangeMover {
property real duration: Math.max(getWidth() * viewTimePerPixel, 500)
property real viewTimePerPixel: 1
property int creationState : 0
property int creationReference : 0
Connections {
target: zoomControl
......@@ -65,6 +66,7 @@ RangeMover {
function reset(setVisible) {
setRight(getLeft() + 1);
creationState = 0;
creationReference = 0;
visible = setVisible;
}
......@@ -75,18 +77,21 @@ RangeMover {
pos = width;
switch (creationState) {
case 1: {
case 1:
creationReference = pos;
setLeft(pos);
setRight(pos + 1);
break;
}
case 2: {
setLeft(Math.min(getLeft(), pos));
setRight(Math.max(getRight(), pos));
case 2:
if (pos > creationReference) {
setLeft(creationReference);
setRight(pos);
} else if (pos < creationReference) {
setLeft(pos);
setRight(creationReference);
}
break;
}
default: return;
}
}
......@@ -104,6 +109,7 @@ RangeMover {
function releasedOnCreation() {
if (selectionRange.creationState === 2) {
flick.interactive = true;
vertflick.stayInteractive = true;
selectionRange.creationState = 3;
selectionRangeControl.enabled = false;
}
......@@ -112,6 +118,7 @@ RangeMover {
function pressedOnCreation() {
if (selectionRange.creationState === 1) {
flick.interactive = false;
vertflick.stayInteractive = false;
selectionRange.setPos(selectionRangeControl.mouseX + flick.contentX);
selectionRange.creationState = 2;
}
......
Supports Markdown
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