From e26596c17340ccd77ca746b5a255acf409092745 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 16 Apr 2015 10:27:30 -0700 Subject: [PATCH] Support for default value and right-click --- src/QmlControls/ParameterEditor.qml | 21 +++++++++++++++++++-- src/VehicleSetup/SetupParameterEditor.qml | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index f8cef4290..ab925eeff 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -25,7 +25,7 @@ /// @author Don Gagne import QtQuick 2.3 -import QtQuick.Controls 1.2 +import QtQuick.Controls 1.3 import QtQuick.Controls.Styles 1.2 import QGroundControl.Controls 1.0 @@ -161,6 +161,23 @@ Rectangle { text: modelFact.valueString + " " + modelFact.units width: __charWidth.contentWidth * 20 height: contentHeight + color: modelFact.valueEqualsDefault ? __qgcPal.text : "orange" + + Menu { + id: rightClickMenu + visible: false + + MenuItem { + id: resetToDefaultMenuItem + text: "Reset to default" + enabled: modelFact.defaultValueAvailable + onTriggered: modelFact.value = modelFact.defaultValue + } + MenuItem { + text: "Set RC to Param" + onTriggered: __controller.setRCToParam(modelData) + } + } MouseArea { anchors.fill: parent @@ -171,7 +188,7 @@ Rectangle { editor.checked = true editor.focus = true } else if (mouse.button == Qt.RightButton) { - __controller.setRCToParam(modelData) + rightClickMenu.popup() } } } diff --git a/src/VehicleSetup/SetupParameterEditor.qml b/src/VehicleSetup/SetupParameterEditor.qml index 4e9e3d4fc..b56eca05c 100644 --- a/src/VehicleSetup/SetupParameterEditor.qml +++ b/src/VehicleSetup/SetupParameterEditor.qml @@ -56,7 +56,7 @@ Rectangle { id: infoLabel width: parent.width wrapMode: Text.WordWrap - text: "Click a parameter value to modify. Right-click to set an RC to Param mapping. Use caution when modifying parameters here since the values are not checked for validity." + text: "Click a parameter value to modify. Right-click for additional options. Values which have been modified from the default are shown in orange. Use caution when modifying parameters here since the values are not checked for validity." } ParameterEditor { -- 2.22.0