Skip to content

Commit

Permalink
Merge pull request #2650 from alicevision/fix/CrashingEdge
Browse files Browse the repository at this point in the history
[ui][fix] Edge: Fixing an issue with mouse event on Custom EdgeMouseArea causing Crash
  • Loading branch information
yann-lty authored Jan 27, 2025
2 parents 2eb30fe + 870dcf4 commit e51bb93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 3 additions & 3 deletions meshroom/ui/components/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, evt):
x = Property(float, lambda self: self._x, constant=True)
y = Property(float, lambda self: self._y, constant=True)
button = Property(Qt.MouseButton, lambda self: self._button, constant=True)
modifiers = Property(int, lambda self: self._modifiers, constant=True)
modifiers = Property(Qt.KeyboardModifier, lambda self: self._modifiers, constant=True)


class EdgeMouseArea(QQuickItem):
Expand Down Expand Up @@ -47,8 +47,8 @@ def hoverLeaveEvent(self, evt):
self.setContainsMouse(False)
super(EdgeMouseArea, self).hoverLeaveEvent(evt)

def geometryChanged(self, newGeometry, oldGeometry):
super(EdgeMouseArea, self).geometryChanged(newGeometry, oldGeometry)
def geometryChange(self, newGeometry, oldGeometry):
super(EdgeMouseArea, self).geometryChange(newGeometry, oldGeometry)
self.updateShape()

def mousePressEvent(self, evt):
Expand Down
7 changes: 1 addition & 6 deletions meshroom/ui/qml/GraphEditor/Edge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,13 @@ Item {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
thickness: root.thickness + 4
curveScale: cubic.ctrlPtDist / root.width // Normalize by width
onPressed: function(event) {
root.pressed(event)
}
onReleased: function(event) {
root.released(event)
}

Component.onCompleted: {
/* The curve scale must be set only once the component has been fully created, so
* that all the events following the update of the curve scale can be taken into
* account. */
curveScale = Qt.binding(() => cubic.ctrlPtDist / root.width) // Normalize by width
}
}
}

0 comments on commit e51bb93

Please sign in to comment.