use qml
This commit is contained in:
+13
@@ -121,6 +121,19 @@ win32|win64 {
|
||||
|
||||
#要发布时要打开,复制必要的库文件
|
||||
#system(xcopy $$src_dir $$dst_dir /y /e)
|
||||
|
||||
|
||||
#复制qml文件
|
||||
qml_src_dir = $$PWD\\*.qml
|
||||
qml_dst_dir = $$PWD\\..\\app_bin\\qml\\
|
||||
# dst_dir 最后的 \\ 是必须的,用来标示 xcopy 到一个文件夹,若不存在,创建之
|
||||
|
||||
# Replace slashes in paths with backslashes for Windows
|
||||
qml_src_dir ~= s,/,\\,g
|
||||
qml_dst_dir ~= s,/,\\,g
|
||||
|
||||
system(xcopy $$qml_src_dir $$qml_dst_dir /y /s)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
|
||||
//检测qml文件夹,如果不存在,那么就新建一个,这里存着所有的qml文件
|
||||
QDir *qmlDir = new QDir;
|
||||
if(!qmlDir->exists("./qml"))
|
||||
qmlDir->mkdir("./qml");//如果文件夹不存在就新建
|
||||
|
||||
|
||||
|
||||
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
//ui initial
|
||||
|
||||
@@ -4,9 +4,9 @@ QT += opengl
|
||||
QT += network
|
||||
QT += sql
|
||||
QT += svg
|
||||
#QT += quickwidgets
|
||||
#QT += quick
|
||||
#QT += qml
|
||||
QT += quickwidgets
|
||||
QT += quick
|
||||
QT += qml
|
||||
|
||||
#CONFIG+=qtquickcompiler
|
||||
|
||||
@@ -84,24 +84,10 @@ INCLUDEPATH += $$PWD/../../mavlink \
|
||||
$$PWD/../../mavlink/XYK \
|
||||
$$PWD/../../mavlink/message_definitions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LIBS += -L$$PWD/../../thirdpart/lib -lcore
|
||||
LIBS += -L$$PWD/../../thirdpart/lib -linternals
|
||||
|
||||
|
||||
|
||||
#POST_TARGETDEPS += $$PWD/../../thirdpart/lib/libcore.a
|
||||
#POST_TARGETDEPS += $$PWD/../../thirdpart/lib/libinternals.a
|
||||
|
||||
|
||||
win32|win64 {
|
||||
src_dir = $$PWD\\*.h
|
||||
dst_dir = $$PWD\\..\\..\\thirdpart\\include\\
|
||||
@@ -112,9 +98,22 @@ win32|win64 {
|
||||
dst_dir ~= s,/,\\,g
|
||||
|
||||
system(xcopy $$src_dir $$dst_dir /y /e)
|
||||
|
||||
|
||||
#复制qml文件
|
||||
qml_src_dir = $$PWD\\*.qml
|
||||
qml_dst_dir = $$PWD\\..\\..\\app_bin\\qml\\
|
||||
# dst_dir 最后的 \\ 是必须的,用来标示 xcopy 到一个文件夹,若不存在,创建之
|
||||
|
||||
# Replace slashes in paths with backslashes for Windows
|
||||
qml_src_dir ~= s,/,\\,g
|
||||
qml_dst_dir ~= s,/,\\,g
|
||||
|
||||
system(xcopy $$qml_src_dir $$qml_dst_dir /y /s)
|
||||
}
|
||||
|
||||
|
||||
DISTFILES += \
|
||||
waypointui.qml
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "ui_propertyui.h"
|
||||
|
||||
|
||||
#include "QtQmlDepends"
|
||||
|
||||
const char* propertyui::_categoryJsonKey = "category";
|
||||
const char* propertyui::_decimalPlacesJsonKey = "decimalPlaces";
|
||||
const char* propertyui::_defaultJsonKey = "default";
|
||||
@@ -47,15 +49,19 @@ propertyui::propertyui(QWidget *parent) :
|
||||
//根据当前点的属性设置界面
|
||||
|
||||
|
||||
/*
|
||||
property_quick = new QQuickWidget(this);
|
||||
property_quick->setFocus();
|
||||
property_quick->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
property_quick->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
QUrl source(QUrl(QStringLiteral("qrc:/qml/propertyUI.qml")));
|
||||
property_quick->setSource(source);
|
||||
//qmlRegisterType<CommandMsg>("CommandMsg", 1, 0, "CommandMsg");
|
||||
|
||||
QObject *pRoot = (QObject*)property_quick->rootObject();
|
||||
//ui->property_quick = new QQuickWidget(this);
|
||||
ui->property_quick->setFocus();
|
||||
ui->property_quick->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
ui->property_quick->setAttribute(Qt::WA_AlwaysStackOnTop);
|
||||
QUrl source(QUrl("./qml/waypointui.qml"));
|
||||
ui->property_quick->setSource(source);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
QObject *pRoot = (QObject*)ui->property_quick->rootObject();
|
||||
const QObjectList list = pRoot->children();
|
||||
|
||||
foreach(QObject *Item,list)//查找 CommandMsg 类,然后连接
|
||||
@@ -68,8 +74,9 @@ propertyui::propertyui(QWidget *parent) :
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "QJsonObject"
|
||||
#include "QJsonParseError"
|
||||
|
||||
/*
|
||||
|
||||
#include "QQuickWidget"
|
||||
#include "QQuickView"
|
||||
#include "QtQml"
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "qqml.h"
|
||||
#include "QQmlEngine"
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "QDebug"
|
||||
|
||||
|
||||
@@ -43,8 +43,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QQuickWidget" name="property_quick">
|
||||
<property name="resizeMode">
|
||||
<enum>QQuickWidget::SizeRootObjectToView</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QQuickWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtQuickWidgets/QQuickWidget</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qml">
|
||||
<file>waypointui.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,114 @@
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
//导入指令模块,这样就能发指令了
|
||||
//import CommandMsg 1.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Templates 2.5
|
||||
|
||||
|
||||
|
||||
Rectangle {
|
||||
|
||||
id:root
|
||||
|
||||
visible: true
|
||||
x:0
|
||||
y:0
|
||||
width: 300
|
||||
height: 320
|
||||
border.width: 1
|
||||
border.color: "blue"
|
||||
color: "#ebc2f0"
|
||||
antialiasing: true
|
||||
|
||||
Rectangle {
|
||||
id: last
|
||||
x: 8
|
||||
y: 8
|
||||
width: 32
|
||||
height: 27
|
||||
color: "#17f403"
|
||||
antialiasing: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: next
|
||||
x: 257
|
||||
y: 8
|
||||
width: 35
|
||||
height: 27
|
||||
color: "#22fd0e"
|
||||
antialiasing: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: seq
|
||||
x: 46
|
||||
y: 8
|
||||
width: 93
|
||||
height: 27
|
||||
color: "#48fcf2"
|
||||
antialiasing: true
|
||||
|
||||
Text {
|
||||
id: element1
|
||||
text: qsTr("Text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: mav_cmd
|
||||
x: 164
|
||||
y: 8
|
||||
width: 87
|
||||
height: 27
|
||||
color: "#e0fb88"
|
||||
antialiasing: true
|
||||
|
||||
Text {
|
||||
id: element
|
||||
text: qsTr("Text")
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottomMargin: 0
|
||||
anchors.leftMargin: 0
|
||||
anchors.topMargin: 0
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 12
|
||||
}
|
||||
}
|
||||
|
||||
Flow {
|
||||
id: element2
|
||||
x: 8
|
||||
y: 41
|
||||
width: 284
|
||||
height: 271
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user