mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-30 10:47:34 +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 bool updateSelectionOnClick: false
|
||||||
property var temporaryEdgeAboutToBeRemoved: undefined
|
property var temporaryEdgeAboutToBeRemoved: undefined
|
||||||
|
|
||||||
function isNodeSelected(index: int) {
|
|
||||||
return uigraph.nodeSelection.isRowSelected(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate: Node {
|
delegate: Node {
|
||||||
id: nodeDelegate
|
id: nodeDelegate
|
||||||
|
|
||||||
|
@ -844,19 +840,12 @@ Item {
|
||||||
mainSelected: uigraph.selectedNode === node
|
mainSelected: uigraph.selectedNode === node
|
||||||
hovered: uigraph.hoveredNode === 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) }
|
onAttributePinCreated: function(attribute, pin) { registerAttributePin(attribute, pin) }
|
||||||
onAttributePinDeleted: function(attribute, pin) { unregisterAttributePin(attribute, pin) }
|
onAttributePinDeleted: function(attribute, pin) { unregisterAttributePin(attribute, pin) }
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: uigraph.nodeSelection
|
|
||||||
|
|
||||||
function onSelectionChanged() {
|
|
||||||
selected = nodeRepeater.isNodeSelected(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onPressed: function(mouse) {
|
onPressed: function(mouse) {
|
||||||
nodeRepeater.updateSelectionOnClick = true;
|
nodeRepeater.updateSelectionOnClick = true;
|
||||||
nodeRepeater.ongoingDrag = true;
|
nodeRepeater.ongoingDrag = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue