Extend copy/paste support to selections containing multiple nodes

This commit is contained in:
Candice Bentéjac 2022-08-24 17:51:05 +02:00
parent 08d502f4a6
commit e11452efdb
2 changed files with 43 additions and 24 deletions

View file

@ -77,9 +77,9 @@ Item {
}
/// Copy node content to clipboard
function copyNode()
function copyNodes()
{
var nodeContent = uigraph.getSelectedNodeContent()
var nodeContent = uigraph.getSelectedNodesContent()
if (nodeContent !== '') {
Clipboard.clear()
Clipboard.setText(nodeContent)
@ -87,11 +87,11 @@ Item {
}
/// Paste content of clipboard to graph editor and create new node if valid
function pasteNode()
function pasteNodes()
{
root.pastePosition = mapToItem(draggable, mouseArea.mouseX, mouseArea.mouseY)
var copiedContent = Clipboard.getText()
uigraph.pasteNode(copiedContent, root.pastePosition)
uigraph.pasteNodes(copiedContent, root.pastePosition)
}
Keys.onPressed: {
@ -107,10 +107,10 @@ Item {
if (event.key === Qt.Key_C)
if (event.modifiers == Qt.ControlModifier)
copyNode()
copyNodes()
if (event.key === Qt.Key_V)
if (event.modifiers == Qt.ControlModifier)
pasteNode()
pasteNodes()
}
MouseArea {