From 0496f0c6a2be12e2aca8d63ae76ffa35a9e0e32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Vital?= Date: Fri, 7 Oct 2022 17:43:28 +0200 Subject: [ui] button to clear node from 2d viewer --- meshroom/ui/qml/Viewer/Viewer2D.qml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 4032e106..6f1db582 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -192,7 +192,6 @@ FocusScope { useExternal = true; sourceExternal = path; displayedNode = null; - metadata = {}; } function getImageFile() { @@ -254,8 +253,13 @@ FocusScope { } onDisplayedNodeChanged: { + // clear metadata if no displayed node + if (!displayedNode) { + metadata = {}; + } + + // update output attribute names var names = []; - // safety check if (displayedNode) { // store attr name for output attributes that represent images for (var i = 0; i < displayedNode.attributes.count; i++) { @@ -626,6 +630,17 @@ FocusScope { Layout.preferredWidth: contentWidth height: contentHeight } + + // button to clear currently displayed node + MaterialToolButton { + id: clearDisplayedNode + text: MaterialIcons.close + ToolTip.text: "Clear node" + enabled: root.displayedNode + onClicked: { + root.displayedNode = null + } + } } } Item { -- cgit v1.2.3