From 1e4c7318639b5b812aa97ebebaed00462f91680b Mon Sep 17 00:00:00 2001 From: Yann Lanthony Date: Mon, 25 Nov 2024 16:37:34 +0100 Subject: [PATCH] [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. --- meshroom/ui/qml/Application.qml | 37 ++++++--------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/meshroom/ui/qml/Application.qml b/meshroom/ui/qml/Application.qml index 76fba7ec1e..74e1194515 100644 --- a/meshroom/ui/qml/Application.qml +++ b/meshroom/ui/qml/Application.qml @@ -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 @@ -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() @@ -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() }