tracing/MainView: Fix broken MouseArea signal handler

onCancelled tries to trigger the signal pressed() which is shadowed
by the property of the same name. Properly handled this by moving
the onPressed handler into its own function.

Change-Id: I8ed966e256acdd8dc76d9ee5b244682217323a0d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Maximilian Goldstein
2022-02-23 11:56:56 +01:00
parent 22dda4f8a5
commit 05d34a7e1a

View File

@@ -259,19 +259,21 @@ Rectangle {
hoverEnabled: enabled hoverEnabled: enabled
z: 2 z: 2
onReleased: { function handlePress() {
if (selectionRange.creationState === selectionRange.creationSecondLimit) {
content.interactive = true;
selectionRange.creationState = selectionRange.creationFinished;
}
}
onPressed: {
if (selectionRange.creationState === selectionRange.creationFirstLimit) { if (selectionRange.creationState === selectionRange.creationFirstLimit) {
content.interactive = false; content.interactive = false;
selectionRange.setPos(selectionRangeControl.mouseX + content.contentX); selectionRange.setPos(selectionRangeControl.mouseX + content.contentX);
selectionRange.creationState = selectionRange.creationSecondLimit; selectionRange.creationState = selectionRange.creationSecondLimit;
} }
} }
onReleased: {
if (selectionRange.creationState === selectionRange.creationSecondLimit) {
content.interactive = true;
selectionRange.creationState = selectionRange.creationFinished;
}
}
onPressed: handlePress()
onPositionChanged: { onPositionChanged: {
if (selectionRange.creationState === selectionRange.creationInactive) if (selectionRange.creationState === selectionRange.creationInactive)
selectionRange.creationState = selectionRange.creationFirstLimit; selectionRange.creationState = selectionRange.creationFirstLimit;
@@ -280,7 +282,7 @@ Rectangle {
selectionRange.creationState !== selectionRange.creationFinished) selectionRange.creationState !== selectionRange.creationFinished)
selectionRange.setPos(selectionRangeControl.mouseX + content.contentX); selectionRange.setPos(selectionRangeControl.mouseX + content.contentX);
} }
onCanceled: pressed() onCanceled: handlePress()
} }
Flickable { Flickable {