mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 17:57:16 +02:00
[ui] GraphEditor: Improve node selected status logic
Instead of connecting to onSelectionChanged, use ItemSelectionModel.hasSelection property, that can be use for direct bindings with the same behavior. https://doc.qt.io/qt-6/qml-qtqml-models-itemselectionmodel.html#hasSelection-prop
This commit is contained in:
parent
a3268f456c
commit
4a60e24c2e
1 changed files with 2 additions and 13 deletions
|
@ -831,10 +831,6 @@ Item {
|
|||
property bool updateSelectionOnClick: false
|
||||
property var temporaryEdgeAboutToBeRemoved: undefined
|
||||
|
||||
function isNodeSelected(index: int) {
|
||||
return uigraph.nodeSelection.isRowSelected(index);
|
||||
}
|
||||
|
||||
delegate: Node {
|
||||
id: nodeDelegate
|
||||
|
||||
|
@ -844,19 +840,12 @@ Item {
|
|||
mainSelected: uigraph.selectedNode === node
|
||||
hovered: uigraph.hoveredNode === node
|
||||
|
||||
selected: nodeRepeater.isNodeSelected(index);
|
||||
// ItemSelectionModel.hasSelection triggers updates anytime the selectionChanged() signal is emitted.
|
||||
selected: uigraph.nodeSelection.hasSelection ? uigraph.nodeSelection.isRowSelected(index) : false
|
||||
|
||||
onAttributePinCreated: function(attribute, pin) { registerAttributePin(attribute, pin) }
|
||||
onAttributePinDeleted: function(attribute, pin) { unregisterAttributePin(attribute, pin) }
|
||||
|
||||
Connections {
|
||||
target: uigraph.nodeSelection
|
||||
|
||||
function onSelectionChanged() {
|
||||
selected = nodeRepeater.isNodeSelected(index);
|
||||
}
|
||||
}
|
||||
|
||||
onPressed: function(mouse) {
|
||||
nodeRepeater.updateSelectionOnClick = true;
|
||||
nodeRepeater.ongoingDrag = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue