mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-04 01:08:26 +02:00
[ui] Change order and put getSelectedNodes function outside specific action
This commit is contained in:
parent
f0e18e6db9
commit
697a8a562f
2 changed files with 49 additions and 63 deletions
|
@ -479,6 +479,16 @@ Item {
|
|||
onTriggered: Qt.openUrlExternally(Filepath.stringToUrl(nodeMenu.currentNode.internalFolder))
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
text: "Cut Node(s)"
|
||||
enabled: true
|
||||
ToolTip.text: "Copy selection to the clipboard and remove it"
|
||||
ToolTip.visible: hovered
|
||||
onTriggered: {
|
||||
copyNodes()
|
||||
uigraph.removeNodes(uigraph.selectedNodes)
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Copy Node(s)"
|
||||
enabled: true
|
||||
|
@ -496,16 +506,6 @@ Item {
|
|||
pasteNodes()
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Cut Node(s)"
|
||||
enabled: true
|
||||
ToolTip.text: "Copy selection to the clipboard and remove it"
|
||||
ToolTip.visible: hovered
|
||||
onTriggered: {
|
||||
copyNodes()
|
||||
uigraph.removeNodes(uigraph.selectedNodes)
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Duplicate Node(s)" + (duplicateFollowingButton.hovered ? " From Here" : "")
|
||||
enabled: true
|
||||
|
|
|
@ -521,43 +521,21 @@ ApplicationWindow {
|
|||
enabled: _reconstruction ? _reconstruction.undoStack.canRedo && !_reconstruction.undoStack.lockedRedo : false
|
||||
onTriggered: _reconstruction.undoStack.redo()
|
||||
}
|
||||
Action {
|
||||
id: copyAction
|
||||
|
||||
property string tooltip: {
|
||||
var s = "Copy selected node"
|
||||
s += (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s (" : " (") + getSelectedNodesName()
|
||||
s += ") to the clipboard"
|
||||
return s
|
||||
}
|
||||
text: "Copy Node" + (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s " : " ")
|
||||
enabled: _reconstruction ? _reconstruction.selectedNodes.count > 0 : false
|
||||
onTriggered: graphEditor.copyNodes()
|
||||
|
||||
function getSelectedNodesName()
|
||||
function getSelectedNodesName()
|
||||
{
|
||||
if (!_reconstruction)
|
||||
return ""
|
||||
var nodesName = ""
|
||||
for (var i = 0; i < _reconstruction.selectedNodes.count; i++)
|
||||
{
|
||||
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
|
||||
if (nodesName !== "")
|
||||
nodesName += ", "
|
||||
var node = _reconstruction.selectedNodes.at(i)
|
||||
nodesName += node.name
|
||||
}
|
||||
return nodesName
|
||||
}
|
||||
|
||||
Action {
|
||||
id: pasteAction
|
||||
|
||||
property string tooltip: "Paste the clipboard content to the project if it contains valid nodes"
|
||||
text: "Paste Node(s)"
|
||||
onTriggered: graphEditor.pasteNodes()
|
||||
}
|
||||
|
||||
Action {
|
||||
id: cutAction
|
||||
|
||||
|
@ -573,23 +551,31 @@ ApplicationWindow {
|
|||
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: copyAction
|
||||
|
||||
property string tooltip: {
|
||||
var s = "Copy selected node"
|
||||
s += (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s (" : " (") + getSelectedNodesName()
|
||||
s += ") to the clipboard"
|
||||
return s
|
||||
}
|
||||
text: "Copy Node" + (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s " : " ")
|
||||
enabled: _reconstruction ? _reconstruction.selectedNodes.count > 0 : false
|
||||
onTriggered: graphEditor.copyNodes()
|
||||
}
|
||||
|
||||
Action {
|
||||
id: pasteAction
|
||||
|
||||
property string tooltip: "Paste the clipboard content to the project if it contains valid nodes"
|
||||
text: "Paste Node(s)"
|
||||
onTriggered: graphEditor.pasteNodes()
|
||||
}
|
||||
|
||||
|
||||
Action {
|
||||
id: loadTemplateAction
|
||||
|
||||
|
@ -826,6 +812,11 @@ ApplicationWindow {
|
|||
ToolTip.visible: hovered
|
||||
ToolTip.text: redoAction.tooltip
|
||||
}
|
||||
MenuItem {
|
||||
action: cutAction
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: cutAction.tooltip
|
||||
}
|
||||
MenuItem {
|
||||
action: copyAction
|
||||
ToolTip.visible: hovered
|
||||
|
@ -836,11 +827,6 @@ ApplicationWindow {
|
|||
ToolTip.visible: hovered
|
||||
ToolTip.text: pasteAction.tooltip
|
||||
}
|
||||
MenuItem {
|
||||
action: cutAction
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: cutAction.tooltip
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
title: "View"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue