Files
gcs-nf/opmap/mapwidget/waypointui.qml
T

504 lines
12 KiB
QML
Raw Normal View History

2020-04-21 13:27:15 +08:00
import QtQuick 2.6
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import QtQuick.Templates 2.5
2020-04-22 21:33:26 +08:00
import QtQuick.Dialogs 1.2
import QtGraphicalEffects 1.0
import Qt.labs.calendar 1.0
import QtQuick.Dialogs.qml 1.0
import QtQuick.Window 2.10
2020-04-29 16:21:03 +08:00
import "MissionManager"
2020-04-22 21:33:26 +08:00
2020-04-21 13:27:15 +08:00
Rectangle {
id:root
visible: true
x:0
y:0
width: 280
2020-04-21 13:27:15 +08:00
height: 320
2020-04-22 21:33:26 +08:00
color: "#fbfdca"
antialiasing: true
property int number : 1
property bool isSettingCategory: false
property bool isFirst: true
property var json: {
"comment": "",
"id": 0,
"rawName": "",
"friendlyName": "null",
"description": "",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "",
"param1": {
"label": "",
"units": "",
"default": 0,
"decimalPlaces": 0
},
"param2": {
"label": "",
"units": "",
"default": 3,
"decimalPlaces": 2
},
"param3": {
"label": "",
"units": "",
"default": 0,
"decimalPlaces": 0
},
"param4": {
"label": "",
"units": "",
"nanUnchanged": true,
"default": 0,
"decimalPlaces": 0
},
"param5": {
"label": "",
"default": 0,
"decimalPlaces": 0
},
"param6": {
"label": "",
"default": 0,
"decimalPlaces": 0
},
"param7": {
"label": "",
"default": 0,
"decimalPlaces": 0
}
}
2020-04-22 14:52:53 +08:00
onJsonChanged: {
if(isFirst == true)
{
//jsonModel.remove(0)
jsonModel.clear()
jsonModel.set(0,json)
isFirst = false
}
else
{
jsonModel.append(json)
2020-04-22 14:52:53 +08:00
//console.log(json)
2020-04-22 21:33:26 +08:00
}
}
2020-04-22 21:33:26 +08:00
property ListModel model : ListModel { id: jsonModel }//总的模型
2020-04-22 21:33:26 +08:00
2020-04-22 14:52:53 +08:00
2020-04-21 13:27:15 +08:00
2020-04-22 21:33:26 +08:00
property var paraJson: {
"label": "",
"units": "",
"defaultValue": 3,
"decimalPlaces": 2
}
2020-04-22 21:33:26 +08:00
onParaJsonChanged: {
paramModel.append(paraJson)
2020-04-22 21:33:26 +08:00
}
property ListModel _paramModel : ListModel { id: paramModel }//参数的模型
2020-04-22 21:33:26 +08:00
2020-04-21 13:27:15 +08:00
Rectangle {
id: last
x: 8
y: 8
width: 32
height: 27
color: "#bbf4b6"
radius: 5
2020-04-22 21:33:26 +08:00
clip: true
2020-04-21 13:27:15 +08:00
antialiasing: true
MouseArea {
2020-04-22 21:33:26 +08:00
clip: true
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"
2020-04-22 21:33:26 +08:00
clip: true
border: 0
}
2020-04-21 13:27:15 +08:00
}
Rectangle {
id: next
x: 238
2020-04-21 13:27:15 +08:00
y: 8
width: 32
2020-04-21 13:27:15 +08:00
height: 27
color: "#bbf4b6"
radius: 5
2020-04-22 21:33:26 +08:00
clip: true
2020-04-21 13:27:15 +08:00
antialiasing: true
MouseArea {
2020-04-22 21:33:26 +08:00
clip: true
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"
2020-04-22 21:33:26 +08:00
clip: true
}
2020-04-21 13:27:15 +08:00
}
Rectangle {
id: seq
x: 46
y: 8
2020-04-22 21:33:26 +08:00
width: 54
2020-04-21 13:27:15 +08:00
height: 27
color: "#b7f3f0"
radius: 5
2020-04-22 21:33:26 +08:00
clip: true
2020-04-21 13:27:15 +08:00
antialiasing: true
Text {
id: seq_text
text: number
font.family: "Arial"
2020-04-22 21:33:26 +08:00
clip: true
2020-04-21 13:27:15 +08:00
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
anchors.fill: parent
font.pixelSize: 12
}
MouseArea {
id: mouseArea
2020-04-22 21:33:26 +08:00
clip: true
hoverEnabled: true
anchors.fill: parent
onEntered: {
parent.color = "#48fcf2"
}
onExited: {
parent.color = "#b7f3f0"
}
}
2020-04-21 13:27:15 +08:00
}
Rectangle {
id: mav_cmd
2020-04-22 21:33:26 +08:00
x: 106
2020-04-21 13:27:15 +08:00
y: 8
2020-04-22 21:33:26 +08:00
width: 126
2020-04-21 13:27:15 +08:00
height: 27
color: "#bae5b4"
radius: 5
2020-04-22 21:33:26 +08:00
clip: true
2020-04-21 13:27:15 +08:00
antialiasing: true
Text {
id: mav_cmd_text
text: ""
2020-04-22 21:33:26 +08:00
clip: true
2020-04-21 13:27:15 +08:00
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
anchors.fill: parent
font.pixelSize: 12
onTextChanged: {
//console.log(text)
//console.log(jsonModel.get(0).friendlyName)
}
2020-04-21 13:27:15 +08:00
}
MouseArea {
2020-04-22 21:33:26 +08:00
clip: true
hoverEnabled: true
anchors.fill: parent
onEntered: {
cursorShape = Qt.PointingHandCursor
parent.color = "#e0fb88"
}
onExited: {
cursorShape = Qt.ArrowCursor
parent.color = "#bae5b4"
}
onClicked: {
//请求所有CMD,并显示
2020-04-22 21:33:26 +08:00
isSettingCategory = true
//console.log(json.toString())
}
}
2020-04-21 13:27:15 +08:00
}
2020-04-21 13:27:15 +08:00
Rectangle {
2020-04-29 16:21:03 +08:00
x: 106
y: 41
2020-04-29 16:21:03 +08:00
width: 167
height: 147
color: "#ffffff"
radius: 9
2020-04-22 21:33:26 +08:00
clip: true
Rectangle {
id: rectangle
color: "#eedbfe"
radius: 10
anchors.bottomMargin: 8
anchors.topMargin: 8
anchors.rightMargin: 8
anchors.leftMargin: 8
anchors.fill: parent
visible: isSettingCategory?(false):(true)
ListView {
id : param_listView
anchors.bottomMargin: 8
anchors.topMargin: 8
anchors.rightMargin: 8
anchors.leftMargin: 8
anchors.fill: parent
model: paramModel
delegate: paramDelegate
spacing: 5
clip: true
focus: true
2020-04-29 16:21:03 +08:00
RadioButton {
id: radioButton
x: 0
y: 15
width: 172
height: 61
text: qsTr("Radio Button")
}
}
Component {
id: paramDelegate
Rectangle {
id: rect_param1
x: 8
y: 8
width: 233
height: 34
color: "#ffffff"
radius: 6
Label {
x: 3
y: 7
width: 47
height: 21
text: label
font.pointSize: 12
font.family: "Arial"
}
Label {
x: 180
y: 8
text: units
font.pointSize: 12
font.family: "Arial"
}
TextEdit {
id: textEdit
x: 56
y: 7
width: 129
height: 21
text: defaultValue
visible: true
clip: false
cursorVisible: false
overwriteMode: false
persistentSelection: true
selectByMouse: true
antialiasing: true
font.family: "Arial"
font.bold: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 13
}
}
}
}
2020-04-22 21:33:26 +08:00
ListView {
id : m_listView
anchors.bottomMargin: 8
anchors.topMargin: 8
anchors.rightMargin: 8
anchors.leftMargin: 8
2020-04-22 14:52:53 +08:00
anchors.fill: parent
model: jsonModel
2020-04-22 21:33:26 +08:00
delegate: numberDelegate
spacing: 5
clip: true
focus: true
visible: isSettingCategory
}
Component {
id: numberDelegate
Rectangle {
width: ListView.view.width
height: ListView.isCurrentItem?100:40
color: ListView.isCurrentItem?"#157efb":"#53d769"
2020-04-22 21:33:26 +08:00
border.color: Qt.lighter(color, 1.1)
radius: 10
2020-04-22 21:33:26 +08:00
Text {
id:friendlyNameText
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 10
font.pixelSize: 10
text: (friendlyName == null)?(rawName):(friendlyName)
2020-04-22 21:33:26 +08:00
}
TextArea {
id:descriptionText
anchors.top:friendlyNameText.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.left: parent.left
2020-04-22 21:33:26 +08:00
anchors.topMargin: 10
anchors.leftMargin: 10
anchors.rightMargin: 10
width: parent.width
height: parent.height - friendlyNameText.height
visible: (parent.height == 100)?true:false
2020-04-22 21:33:26 +08:00
font.pixelSize: 10
text: (description == null)?(""):(description)
2020-04-22 21:33:26 +08:00
}
MouseArea {
anchors.rightMargin: -50
hoverEnabled: true
anchors.fill: parent
onClicked:{
m_listView.currentIndex = index //实现item切换
isSettingCategory = false
mav_cmd_text.text = friendlyNameText.text
2020-04-22 21:33:26 +08:00
paraJson = jsonModel.get(index)
2020-04-22 21:33:26 +08:00
}
2020-04-22 21:33:26 +08:00
onEntered: {
descriptionText.visible = true
m_listView.currentIndex = index //实现item切换
mav_cmd_text.text = friendlyNameText.text
2020-04-22 21:33:26 +08:00
}
onExited: {
2020-04-22 21:33:26 +08:00
descriptionText.visible = false
mav_cmd_text.text = friendlyNameText.text
2020-04-22 14:52:53 +08:00
}
2020-04-22 14:52:53 +08:00
}
}
}
2020-04-29 16:21:03 +08:00
}
RadioButton {
id: radioButton1
x: 32
y: 223
width: 51
height: 42
text: qsTr("Radio Button")
}
2020-04-21 13:27:15 +08:00
}
2020-04-21 13:27:15 +08:00
2020-04-22 14:52:53 +08:00