Skip to content

Commit

Permalink
[ui] Application: Simplify Cut/CopyNodes actions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yann-lty committed Nov 25, 2024
1 parent c552c05 commit 1e4c731
Showing 1 changed file with 6 additions and 31 deletions.
37 changes: 6 additions & 31 deletions meshroom/ui/qml/Application.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ Page {
property alias showImageGallery: imageGalleryVisibilityCB.checked
}

// Utility functions for elements in the menubar
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)
if(node) {
nodesName += node.name
}
}
return nodesName
}

property url imagesFolder: {
var recentImportedImagesFolders = MeshroomApp.recentImportedImagesFolders
Expand Down Expand Up @@ -478,14 +463,9 @@ Page {
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
property string tooltip: "Cut Selected Node(s)"
text: "Cut Node(s)"
enabled: _reconstruction ? _reconstruction.nodeSelection.hasSelection : false
onTriggered: {
graphEditor.copyNodes()
graphEditor.uigraph.removeSelectedNodes()
Expand All @@ -495,14 +475,9 @@ Page {
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
property string tooltip: "Copy Selected Node(s)"
text: "Copy Node(s)"
enabled: _reconstruction ? _reconstruction.nodeSelection.hasSelection : false
onTriggered: graphEditor.copyNodes()
}

Expand Down

0 comments on commit 1e4c731

Please sign in to comment.