[ui] Restrain the "copy/paste nodes" shortcuts to the GraphEditor

If a Ctrl+C or Ctrl+V shortcut is performed outside the GraphEditor,
the performed action should not be a copy or a paste of the nodes, but
the own copy/paste of the current element (e.g. if a Ctrl+C is made on
on the NodeEditor, then the copied element should be the one selected
in the NodeEditor, not the currently selected node).
This commit is contained in:
Candice Bentéjac 2022-09-26 09:54:25 +02:00
parent 0f5ffd7d7c
commit 58784fb6ff
2 changed files with 4 additions and 2 deletions

View file

@ -114,6 +114,10 @@ Item {
uigraph.removeNodes(uigraph.selectedNodes)
if (event.key === Qt.Key_D)
duplicateNode(event.modifiers == Qt.AltModifier)
if (event.key === Qt.Key_C && event.modifiers == Qt.ControlModifier)
copyNodes()
if (event.key === Qt.Key_V && event.modifiers == Qt.ControlModifier)
pasteNodes()
}
MouseArea {

View file

@ -430,7 +430,6 @@ ApplicationWindow {
return s
}
text: "Copy Node" + (_reconstruction.selectedNodes.count > 1 ? "s " : " ")
shortcut: "Ctrl+C"
enabled: _reconstruction.selectedNodes.count > 0
onTriggered: graphEditor.copyNodes()
@ -453,7 +452,6 @@ ApplicationWindow {
property string tooltip: "Paste the clipboard content to the scene if it contains valid nodes"
text: "Paste Node(s)"
shortcut: "Ctrl+V"
onTriggered: graphEditor.pasteNodes()
}