From c45ebdf83cef658a5b2787d1d77f41bf768dc5fe Mon Sep 17 00:00:00 2001 From: Yann Lanthony Date: Mon, 5 Feb 2018 18:26:24 +0100 Subject: [PATCH] [ui] AttributeEditor: add contextual menu on attributes * allow to expose additional actions on individuals attributes * add 'Reset to Default Value' action --- .../ui/qml/GraphEditor/AttributeItemDelegate.qml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml index d9d916cd..1559fd51 100644 --- a/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml +++ b/meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml @@ -49,8 +49,24 @@ RowLayout { hoverEnabled: true acceptedButtons: Qt.AllButtons + property Component menuComp: Menu { + id: paramMenu + + MenuItem { + text: "Reset To Default Value" + enabled: !attribute.isOutput && !attribute.isLink && !attribute.isDefault + onTriggered: _reconstruction.resetAttribute(attribute) + } + } + onClicked: { forceActiveFocus() + if(mouse.button == Qt.RightButton) + { + var menu = menuComp.createObject(parameterLabel) + menu.parent = parameterLabel + menu.popup() + } } } }