[ui] Add of Cut option in Edit menu

This commit is contained in:
Aurore LAFAURIE 2024-05-07 13:42:36 +02:00
parent c3ab36deb0
commit f0e18e6db9

View file

@ -558,6 +558,38 @@ ApplicationWindow {
onTriggered: graphEditor.pasteNodes()
}
Action {
id: cutAction
property string tooltip: {
var s = "Copy selected node"
s += (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s (" : " (") + getSelectedNodesName()
s += ") to the clipboard and remove them from the graph"
return s
}
text: "Cut Node" + (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s " : " ")
enabled: _reconstruction ? _reconstruction.selectedNodes.count > 0 : false
onTriggered: {
graphEditor.copyNodes()
graphEditor.uigraph.removeNodes(graphEditor.uigraph.selectedNodes)
}
function getSelectedNodesName()
{
if (!_reconstruction)
return ""
var nodesName = ""
for (var i = 0; i < _reconstruction.selectedNodes.count; i++)
{
if (nodesName !== "")
nodesName += ", "
var node = _reconstruction.selectedNodes.at(i)
nodesName += node.name
}
return nodesName
}
}
Action {
id: loadTemplateAction
@ -804,6 +836,11 @@ ApplicationWindow {
ToolTip.visible: hovered
ToolTip.text: pasteAction.tooltip
}
MenuItem {
action: cutAction
ToolTip.visible: hovered
ToolTip.text: cutAction.tooltip
}
}
Menu {
title: "View"