From d7aa3a1fe0832ed429ff983c2f5afa14d984fa36 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 23 Dec 2014 15:59:22 -0800 Subject: [PATCH] Add FactLabel and FactTextField qml controls --- qgroundcontrol.qrc | 8 ++++++++ qml/QGroundControl/FactControls/FactLabel.qml | 13 +++++++++++++ qml/QGroundControl/FactControls/FactTextField.qml | 14 ++++++++++++++ qml/QGroundControl/FactControls/qmldir | 3 ++- src/AutoPilotPlugins/PX4/SafetyComponent.qml | 5 ++++- 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 qml/QGroundControl/FactControls/FactLabel.qml create mode 100644 qml/QGroundControl/FactControls/FactTextField.qml diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 407433977..6b317dc3b 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -237,12 +237,20 @@ src/test.qml + qml/QGroundControl/FactControls/qmldir + + qml/QGroundControl/FactControls/SetupButton.qml + qml/QGroundControl/FactControls/FactLabel.qml + qml/QGroundControl/FactControls/FactTextField.qml + files/images/px4/airframes/octo_x.png files/images/px4/boards/px4fmu_2.x.png + src/VehicleSetup/SetupViewConnected.qml src/VehicleSetup/SetupViewDisconnected.qml + src/AutoPilotPlugins/PX4/SafetyComponent.qml diff --git a/qml/QGroundControl/FactControls/FactLabel.qml b/qml/QGroundControl/FactControls/FactLabel.qml new file mode 100644 index 000000000..a98f050b6 --- /dev/null +++ b/qml/QGroundControl/FactControls/FactLabel.qml @@ -0,0 +1,13 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QGroundControl.FactSystem 1.0 + +Label { + property Fact fact: Fact { value: "FactLabel" } + QGCPalette { id: palette; colorGroup: QGCPalette.Active } + + color: palette.windowText + + text: fact.value +} diff --git a/qml/QGroundControl/FactControls/FactTextField.qml b/qml/QGroundControl/FactControls/FactTextField.qml new file mode 100644 index 000000000..b42ac3cc5 --- /dev/null +++ b/qml/QGroundControl/FactControls/FactTextField.qml @@ -0,0 +1,14 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QGroundControl.FactSystem 1.0 + +TextField { + property Fact fact: Fact { value: 0 } + + QGCPalette { id: palette; colorGroup: QGCPalette.Active } + + text: fact.value + + onAccepted: fact.value = text +} diff --git a/qml/QGroundControl/FactControls/qmldir b/qml/QGroundControl/FactControls/qmldir index 5c68157e2..b0c9edb64 100644 --- a/qml/QGroundControl/FactControls/qmldir +++ b/qml/QGroundControl/FactControls/qmldir @@ -1,2 +1,3 @@ Module QGroundControl.FactControls -SetupButton 1.0 SetupButton.qml \ No newline at end of file +FactLabel 1.0 FactLabel.qml +FactTextField 1.0 FactTextField.qml \ No newline at end of file diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index 3ef047174..9e958ebdc 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -2,6 +2,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 Rectangle { QGCPalette { id: palette; colorGroup: QGCPalette.Active } @@ -12,6 +13,8 @@ Rectangle { Column { Label { text: "Work in Progress"; color: palette.windowText } - Label { text: autopilot.parameters["RTL_RETURN_ALT"].value; color: palette.windowText } + Label { text: "Return to Land Altitude"; color: palette.windowText } + FactLabel { fact: autopilot.parameters["RTL_RETURN_ALT"] } + FactTextField { fact: autopilot.parameters["RTL_RETURN_ALT"] } } } -- 2.22.0