Skip to content

Commit 1e4c731

Browse files
committed
[ui] Application: Simplify Cut/CopyNodes actions
Remove dynamic tooltip for cut/copy actions that displays all selected node names: - This inline textual information is hard to process as a user. - Avoid binding to and iteration over the selection.
1 parent c552c05 commit 1e4c731

File tree

1 file changed

+6
-31
lines changed

1 file changed

+6
-31
lines changed

meshroom/ui/qml/Application.qml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,6 @@ Page {
3030
property alias showImageGallery: imageGalleryVisibilityCB.checked
3131
}
3232

33-
// Utility functions for elements in the menubar
34-
function getSelectedNodesName() {
35-
if (!_reconstruction)
36-
return ""
37-
var nodesName = ""
38-
for (var i = 0; i < _reconstruction.selectedNodes.count; i++) {
39-
if (nodesName !== "")
40-
nodesName += ", "
41-
var node = _reconstruction.selectedNodes.at(i)
42-
if(node) {
43-
nodesName += node.name
44-
}
45-
}
46-
return nodesName
47-
}
4833

4934
property url imagesFolder: {
5035
var recentImportedImagesFolders = MeshroomApp.recentImportedImagesFolders
@@ -478,14 +463,9 @@ Page {
478463
Action {
479464
id: cutAction
480465

481-
property string tooltip: {
482-
var s = "Copy selected node"
483-
s += (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s (" : " (") + getSelectedNodesName()
484-
s += ") to the clipboard and remove them from the graph"
485-
return s
486-
}
487-
text: "Cut Node" + (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s " : " ")
488-
enabled: _reconstruction ? _reconstruction.selectedNodes.count > 0 : false
466+
property string tooltip: "Cut Selected Node(s)"
467+
text: "Cut Node(s)"
468+
enabled: _reconstruction ? _reconstruction.nodeSelection.hasSelection : false
489469
onTriggered: {
490470
graphEditor.copyNodes()
491471
graphEditor.uigraph.removeSelectedNodes()
@@ -495,14 +475,9 @@ Page {
495475
Action {
496476
id: copyAction
497477

498-
property string tooltip: {
499-
var s = "Copy selected node"
500-
s += (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s (" : " (") + getSelectedNodesName()
501-
s += ") to the clipboard"
502-
return s
503-
}
504-
text: "Copy Node" + (_reconstruction && _reconstruction.selectedNodes.count > 1 ? "s " : " ")
505-
enabled: _reconstruction ? _reconstruction.selectedNodes.count > 0 : false
478+
property string tooltip: "Copy Selected Node(s)"
479+
text: "Copy Node(s)"
480+
enabled: _reconstruction ? _reconstruction.nodeSelection.hasSelection : false
506481
onTriggered: graphEditor.copyNodes()
507482
}
508483

0 commit comments

Comments
 (0)