添加qml,可以使用qml编辑航点属性
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import QtQuick 2.6
|
||||
|
||||
Canvas {
|
||||
id: canvasId
|
||||
property color color: "#474747"
|
||||
property string direction: "normal"
|
||||
property int border: 0
|
||||
property int border_color: 0
|
||||
|
||||
width: parent.width; height: parent.height
|
||||
contextType: "2d"
|
||||
|
||||
onPaint: {
|
||||
context.lineWidth = border
|
||||
|
||||
context.strokeStyle = "#00000000"
|
||||
context.fillStyle = color
|
||||
context.beginPath();
|
||||
|
||||
if(direction == "normal")
|
||||
{
|
||||
context.moveTo(0, 0)
|
||||
context.lineTo(0, canvasId.height);
|
||||
context.lineTo(canvasId.width, canvasId.height/2);
|
||||
}
|
||||
else
|
||||
{
|
||||
context.moveTo(0, canvasId.height/2)
|
||||
context.lineTo(canvasId.width, 0);
|
||||
context.lineTo(canvasId.width, canvasId.height);
|
||||
}
|
||||
context.closePath();
|
||||
context.fill()
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ win32|win64 {
|
||||
}
|
||||
|
||||
DISTFILES += \
|
||||
Triangle.qml \
|
||||
waypointui.qml
|
||||
|
||||
|
||||
|
||||
@@ -55,13 +55,19 @@ propertyui::propertyui(QWidget *parent) :
|
||||
ui->property_quick->setFocus();
|
||||
ui->property_quick->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
ui->property_quick->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
QUrl source(QUrl("./qml/waypointui.qml"));
|
||||
//QUrl source(QUrl("./qml/waypointui.qml"));
|
||||
QUrl source(QUrl("../opmap/mapwidget/waypointui.qml"));
|
||||
ui->property_quick->setSource(source);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
QObject *pRoot = (QObject*)ui->property_quick->rootObject();
|
||||
|
||||
qDebug() << pRoot->property("friendlyName");
|
||||
|
||||
|
||||
/*
|
||||
const QObjectList list = pRoot->children();
|
||||
|
||||
foreach(QObject *Item,list)//查找 CommandMsg 类,然后连接
|
||||
@@ -79,6 +85,7 @@ propertyui::propertyui(QWidget *parent) :
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
propertyui::~propertyui()
|
||||
@@ -141,34 +148,9 @@ void propertyui::_loadMavCmdInfoJson(const QString& jsonFilename, bool baseComma
|
||||
|
||||
qDebug() << info << endl;
|
||||
|
||||
|
||||
/*
|
||||
MissionCommandUIInfo* uiInfo = new MissionCommandUIInfo(this);
|
||||
|
||||
QString errorString;
|
||||
if (!uiInfo->loadJsonInfo(info.toObject(), baseCommandList, errorString)) {
|
||||
uiInfo->deleteLater();
|
||||
qWarning() << jsonFilename << errorString;
|
||||
return;
|
||||
}
|
||||
|
||||
// Update list of known categories
|
||||
QString newCategory = uiInfo->category();
|
||||
if (!newCategory.isEmpty() && !_categories.contains(newCategory)) {
|
||||
_categories.append(newCategory);
|
||||
}
|
||||
|
||||
_infoMap[uiInfo->command()] = uiInfo;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
// Build id list
|
||||
/*
|
||||
for (MAV_CMD id: _infoMap.keys()) {
|
||||
_ids << id;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>481</width>
|
||||
<height>323</height>
|
||||
<width>280</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -30,20 +30,6 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QQuickWidget" name="property_quick">
|
||||
<property name="resizeMode">
|
||||
<enum>QQuickWidget::SizeRootObjectToView</enum>
|
||||
|
||||
+163
-26
@@ -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}
|
||||
}
|
||||
##^##*/
|
||||
|
||||
Reference in New Issue
Block a user