Browse Source
- properties now hand off of main “autopilot” object in qml - Added support for summary items through qmlQGC4.4
29 changed files with 631 additions and 330 deletions
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
import QtQuick 2.2 |
||||
import QtQuick.Controls 1.2 |
||||
import QGroundControl.FactSystem 1.0 |
||||
|
||||
TextInput { |
||||
property Fact fact |
||||
text: fact.value |
||||
font.family: "Helvetica" |
||||
font.pointSize: 24 |
||||
color: "red" |
||||
focus: true |
||||
onAccepted: { fact.value = text; } |
||||
} |
@ -0,0 +1,163 @@
@@ -0,0 +1,163 @@
|
||||
import QtQuick 2.2 |
||||
import QtQuick.Controls 1.2 |
||||
import QtQuick.Controls.Styles 1.2 |
||||
|
||||
Button { |
||||
text: "Button" |
||||
property bool setupComplete: false |
||||
|
||||
property var summaryModel: ListModel { |
||||
ListElement { name: "Row 1"; state: "State 1" } |
||||
ListElement { name: "Row 2"; state: "State 2" } |
||||
ListElement { name: "Row 3"; state: "State 3" } |
||||
} |
||||
|
||||
style: ButtonStyle { |
||||
id: buttonStyle |
||||
background: Rectangle { |
||||
id: innerRect |
||||
readonly property real titleHeight: 30 |
||||
|
||||
//property alias summaryModel: summaryList.model |
||||
|
||||
border.color: "#888" |
||||
radius: 10 |
||||
|
||||
color: control.activeFocus ? "#47b" : "white" |
||||
opacity: control.hovered || control.activeFocus ? 1 : 0.75 |
||||
Behavior on opacity {NumberAnimation{ duration: 100 }} |
||||
|
||||
Text { |
||||
id: titleBar |
||||
|
||||
width: parent.width |
||||
height: parent.titleHeight |
||||
|
||||
verticalAlignment: TextEdit.AlignVCenter |
||||
horizontalAlignment: TextEdit.AlignHCenter |
||||
|
||||
text: control.text |
||||
font.pixelSize: 12 |
||||
|
||||
Rectangle { |
||||
id: setupIndicator |
||||
|
||||
property bool setupComplete: true |
||||
readonly property real indicatorRadius: 6 |
||||
|
||||
x: parent.width - (indicatorRadius * 2) - 5 |
||||
y: (parent.height - (indicatorRadius * 2)) / 2 |
||||
width: indicatorRadius * 2 |
||||
height: indicatorRadius * 2 |
||||
|
||||
radius: indicatorRadius |
||||
color: control.setupComplete ? "green" : "red" |
||||
} |
||||
} |
||||
|
||||
Rectangle { |
||||
width: parent.width |
||||
height: parent.height - parent.titleHeight |
||||
|
||||
y: parent.titleHeight |
||||
|
||||
border.color: "#888" |
||||
|
||||
gradient: Gradient { |
||||
GradientStop { position: 0; color: "#ffffff" } |
||||
GradientStop { position: 1; color: "#000000" } |
||||
} |
||||
|
||||
ListView { |
||||
id: summaryList |
||||
anchors.fill: parent |
||||
model: control.summaryModel |
||||
delegate: Row { |
||||
Text { text: modelData.name } |
||||
Text { text: modelData.state } |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
label: Item {} |
||||
} |
||||
} |
||||
|
||||
/* |
||||
Rectangle { |
||||
readonly property real titleHeight: 30 |
||||
|
||||
property alias title: titleBar.text |
||||
property alias setupComplete: setupIndicator.setupComplete |
||||
//property alias summaryModel: summaryList.model |
||||
|
||||
border.color: "#888" |
||||
radius: 10 |
||||
|
||||
gradient: Gradient { |
||||
GradientStop { position: 0 ; color: "#cccccc" } |
||||
GradientStop { position: 1 ; color: "#aaa" } |
||||
} |
||||
|
||||
Text { |
||||
id: titleBar |
||||
|
||||
width: parent.width |
||||
height: parent.titleHeight |
||||
|
||||
verticalAlignment: TextEdit.AlignVCenter |
||||
horizontalAlignment: TextEdit.AlignHCenter |
||||
|
||||
text: qsTr("TITLE") |
||||
font.pixelSize: 12 |
||||
|
||||
Rectangle { |
||||
id: setupIndicator |
||||
|
||||
property bool setupComplete: true |
||||
readonly property real indicatorRadius: 6 |
||||
|
||||
x: parent.width - (indicatorRadius * 2) - 5 |
||||
y: (parent.height - (indicatorRadius * 2)) / 2 |
||||
width: indicatorRadius * 2 |
||||
height: indicatorRadius * 2 |
||||
|
||||
radius: indicatorRadius |
||||
color: setupComplete ? "green" : "red" |
||||
} |
||||
} |
||||
|
||||
Rectangle { |
||||
width: parent.width |
||||
height: parent.height - parent.titleHeight |
||||
|
||||
y: parent.titleHeight |
||||
|
||||
border.color: "#888" |
||||
|
||||
gradient: Gradient { |
||||
GradientStop { |
||||
position: 0 |
||||
color: "#ffffff" |
||||
} |
||||
|
||||
GradientStop { |
||||
position: 1 |
||||
color: "#000000" |
||||
} |
||||
} |
||||
|
||||
ListView { |
||||
id: summaryList |
||||
anchors.fill: parent |
||||
model: ListModel { |
||||
ListElement { name: "Row 1"; state: "State 1" } |
||||
ListElement { name: "Row 2"; state: "State 2" } |
||||
ListElement { name: "Row 3"; state: "State 3" } |
||||
} |
||||
delegate: Row { Text { text: modelData.name } Text { text: modelData.state } } |
||||
} |
||||
} |
||||
} |
||||
*/ |
@ -1,2 +1,2 @@
@@ -1,2 +1,2 @@
|
||||
Module QGroundControl.FactControls |
||||
FactTextInput 1.0 FactTextInput.qml |
||||
SetupButton 1.0 SetupButton.qml |
@ -1,16 +1,15 @@
@@ -1,16 +1,15 @@
|
||||
import QtQuick 2.2 |
||||
import QtQuick.Controls 1.2 |
||||
import QGroundControl.FactSystem 1.0 |
||||
import QGroundControlFactControls 1.0 |
||||
|
||||
Item { |
||||
TextInput { |
||||
objectName: "testControl" |
||||
text: parameters["RC_MAP_THROTTLE"].value |
||||
text: autopilot.parameters["RC_MAP_THROTTLE"].value |
||||
font.family: "Helvetica" |
||||
font.pointSize: 24 |
||||
color: "red" |
||||
focus: true |
||||
onAccepted: { parameters["RC_MAP_THROTTLE"].value = text; } |
||||
onAccepted: { autopilot.parameters["RC_MAP_THROTTLE"].value = text; } |
||||
} |
||||
} |
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
import QtQuick 2.2 |
||||
import QtQuick.Controls 1.2 |
||||
import QGroundControlFactControls 1.0 |
||||
|
||||
SetupButton { |
||||
width: 300 |
||||
height: 200 |
||||
title: vehicleComponent.name |
||||
} |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
/*=====================================================================
|
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
/// @file
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
#include "VehicleComponentSummaryItem.h" |
||||
|
||||
VehicleComponentSummaryItem::VehicleComponentSummaryItem(const QString& name, const QString& state, QObject* parent) : |
||||
QObject(parent), |
||||
_name(name), |
||||
_state(state) |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
/*=====================================================================
|
||||
|
||||
QGroundControl Open Source Ground Control Station |
||||
|
||||
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||
|
||||
This file is part of the QGROUNDCONTROL project |
||||
|
||||
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
======================================================================*/ |
||||
|
||||
#ifndef VehicleComponentSummaryItem_H |
||||
#define VehicleComponentSummaryItem_H |
||||
|
||||
#include <QObject> |
||||
#include <QQmlContext> |
||||
#include <QQuickItem> |
||||
|
||||
#include "UASInterface.h" |
||||
|
||||
/// @file
|
||||
/// @brief Vehicle Component class. A vehicle component is an object which
|
||||
/// abstracts the physical portion of a vehicle into a set of
|
||||
/// configurable values and user interface.
|
||||
/// @author Don Gagne <don@thegagnes.com>
|
||||
|
||||
class VehicleComponentSummaryItem : public QObject |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
Q_PROPERTY(QString name READ name CONSTANT) |
||||
Q_PROPERTY(QString state READ state CONSTANT) |
||||
|
||||
public: |
||||
VehicleComponentSummaryItem(const QString& name, const QString& state, QObject* parent = NULL); |
||||
|
||||
QString name(void) const { return _name; } |
||||
QString state(void) const { return _state; } |
||||
|
||||
protected: |
||||
QString _name; |
||||
QString _state; |
||||
}; |
||||
|
||||
#endif |
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
import QtQuick 2.2 |
||||
import QtQuick.Controls 1.2 |
||||
import QtQuick.Controls.Styles 1.2 |
||||
//import QGroundControl.FactControls 1.0 |
||||
|
||||
Row { |
||||
width: 200 |
||||
Text { id: firstCol; text: "Col 1" } |
||||
Text { horizontalAlignment: Text.AlignRight; width: parent.width - firstCol.contentWidth; text: "Col 2" } |
||||
} |
Loading…
Reference in new issue