添加qml,可以使用qml编辑航点属性

This commit is contained in:
2020-04-21 18:05:42 +08:00
parent a4e806e8a1
commit aa6e00d7f8
5 changed files with 213 additions and 70 deletions
+163 -26
View File
@@ -6,20 +6,32 @@ import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import QtQuick.Templates 2.5
Rectangle {
id:root
visible: true
x:0
y:0
width: 300
width: 280
height: 320
color: "#585d83"
//property ComboBox name: "value"
//property ListModel json: 0
property string rawName : "MAV_CMD_NAV_WAYPOINT"
property string friendlyName: "Waypoint"
property string description : "Travel to a position in 3D space."
property bool specifiesCoordinate: true
property bool friendlyEdit: true
property string category: "Basic"
property int number : 1
border.width: 1
border.color: "blue"
color: "#ebc2f0"
antialiasing: true
Rectangle {
@@ -28,18 +40,60 @@ Rectangle {
y: 8
width: 32
height: 27
color: "#17f403"
color: "#bbf4b6"
radius: 5
antialiasing: true
MouseArea {
hoverEnabled: true
anchors.fill: parent
onEntered: {
parent.color = "#22fd0e"
}
onExited: {
parent.color = "#bbf4b6"
}
//请求读取上一个航点的属性
}
Triangle {
x: 5
y: 4
width: 20
height: 20
direction: "reverse"
color: "#b344fb"
border: 0
}
}
Rectangle {
id: next
x: 257
x: 238
y: 8
width: 35
width: 32
height: 27
color: "#22fd0e"
color: "#bbf4b6"
radius: 5
antialiasing: true
MouseArea {
hoverEnabled: true
anchors.fill: parent
onEntered: {
parent.color = "#22fd0e"
}
onExited: {
parent.color = "#bbf4b6"
}
//请求读取下一个航点的属性
}
Triangle {
id: triangle
x: 7
y: 4
width: 20
height: 20
color: "#b344fb"
}
}
Rectangle {
@@ -48,31 +102,45 @@ Rectangle {
y: 8
width: 93
height: 27
color: "#48fcf2"
color: "#b7f3f0"
radius: 5
antialiasing: true
Text {
id: element1
text: qsTr("Text")
id: seq_text
text: number
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
anchors.fill: parent
font.pixelSize: 12
}
MouseArea {
id: mouseArea
hoverEnabled: true
anchors.fill: parent
onEntered: {
parent.color = "#48fcf2"
}
onExited: {
parent.color = "#b7f3f0"
}
}
}
Rectangle {
id: mav_cmd
x: 164
x: 145
y: 8
width: 87
height: 27
color: "#e0fb88"
color: "#bae5b4"
radius: 5
antialiasing: true
Text {
id: element
text: qsTr("Text")
id: mav_cmd_text
text: qsTr(friendlyName)
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
@@ -82,29 +150,90 @@ Rectangle {
anchors.fill: parent
font.pixelSize: 12
}
MouseArea {
hoverEnabled: true
anchors.fill: parent
onEntered: {
cursorShape = Qt.PointingHandCursor
parent.color = "#e0fb88"
}
onExited: {
cursorShape = Qt.ArrowCursor
parent.color = "#bae5b4"
}
onClicked: {
//请求所有CMD,并显示
}
}
}
Flow {
id: element2
Rectangle {
x: 8
y: 41
width: 284
width: 265
height: 271
color: "#ffffff"
radius: 9
ItemDelegate {
id: control
text: qsTr("ItemDelegate")
checkable: true
checked: true
anchors.fill: parent
contentItem: Text {
rightPadding: control.spacing
text: control.text
font: control.font
color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
color: control.down ? "#dddedf" : "#eeeeee"
Rectangle {
width: parent.width
height: 1
color: control.down ? "#17a81a" : "#21be2b"
anchors.bottom: parent.bottom
}
}
}
}
}
QJsonValue(object,
QJsonObject(
{"category":"VTOL",
"description":"Perform flight mode transition.",
"friendlyName":"VTOL Transition",
"id":3000,
"param1":{
"default":3,
"enumStrings":"Hover Mode,Plane Mode",
"enumValues":"3,4",
"label":"Mode"
},
"rawName":"MAV_CMD_DO_VTOL_TRANSITION"}
)
)
@@ -112,3 +241,11 @@ Rectangle {
/*##^##
Designer {
D{i:8;anchors_height:100;anchors_width:100}D{i:10;anchors_height:100;anchors_width:100}
D{i:14;anchors_height:263;anchors_width:246}
}
##^##*/