From efb13f1d7d9d615685afd72ad9a718ccda755d3b Mon Sep 17 00:00:00 2001 From: waaake Date: Mon, 3 Feb 2025 17:02:57 +0530 Subject: [PATCH] [ui] Edge: Added mouse area which checks clicks on edgeArea The workaround on edge crashing is to use the mouse area around the edge and query if the click exists in the edge to accept pressed or released signal --- meshroom/ui/qml/GraphEditor/Edge.qml | 31 ++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/meshroom/ui/qml/GraphEditor/Edge.qml b/meshroom/ui/qml/GraphEditor/Edge.qml index e6832ede..503a0d73 100644 --- a/meshroom/ui/qml/GraphEditor/Edge.qml +++ b/meshroom/ui/qml/GraphEditor/Edge.qml @@ -139,12 +139,35 @@ Item { acceptedButtons: Qt.LeftButton | Qt.RightButton thickness: root.thickness + 4 curveScale: cubic.ctrlPtDist / root.width // Normalize by width + } + + MouseArea { + x: Math.min(0, root.width) + y: Math.min(0, root.height) + height: Math.abs(root.height) + width: Math.abs(root.width) + acceptedButtons: Qt.LeftButton | Qt.RightButton + onPressed: function(event) { - root.pressed(event) - } - onReleased: function(event) { - root.released(event) + let xpos = root.width < 0 ? root.height + event.x : event.x; + let ypos = root.height < 0 ? root.height + event.y: event.y; + if (edgeArea.containsPoint(Qt.point(xpos, ypos))) { + root.pressed(event); + } + else { + event.accepted = false; + } } + onReleased: function(event) { + let xpos = root.width < 0 ? root.height + event.x : event.x; + let ypos = root.height < 0 ? root.height + event.y: event.y; + if (edgeArea.containsPoint(Qt.point(xpos, ypos))) { + root.released(event); + } + else { + event.accepted = false; + } + } } }