b
This commit is contained in:
@@ -116,8 +116,6 @@ INCLUDEPATH += $$PWD/../mavlink \
|
||||
|
||||
# Capture whether this is a release/debug build.
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lSkind
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lqNavigationd
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lCockpitd
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lMavLinkNoded
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lcored
|
||||
@@ -126,8 +124,6 @@ CONFIG(debug, debug|release) {
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lDlinkd
|
||||
}
|
||||
CONFIG(release, debug|release) {
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lSkin
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lqNavigation
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lCockpit
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lMavLinkNode
|
||||
LIBS += -L$$PWD/../thirdpart/lib -lcore
|
||||
|
||||
@@ -23,8 +23,13 @@ public:
|
||||
explicit MenuBarUI(QWidget *parent = nullptr);
|
||||
~MenuBarUI();
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
void clearMessage();
|
||||
|
||||
signals:
|
||||
|
||||
void IndexChanged(int);
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
#include "mainwindow.h"
|
||||
//#include "splashscreen.h"
|
||||
//#include "unit.h"
|
||||
#include "skin.h"
|
||||
//#include "appconfig.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
+42
-15
@@ -5,7 +5,12 @@
|
||||
#include "QHBoxLayout"
|
||||
|
||||
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QUrl>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
@@ -183,7 +188,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(map,SIGNAL(signal_WPUpload(uint8_t,uint8_t,uint32_t)),
|
||||
dlink->mavlinknode->Mission,SLOT(WriteCmd(uint8_t,uint8_t,uint32_t)),Qt::DirectConnection);
|
||||
|
||||
//qRegisterMetaType<int32_t>("int32_t");
|
||||
|
||||
//生成航线必须在map线程完成,因此不能直接连接
|
||||
//停下来让ui、运行一下
|
||||
@@ -214,8 +218,29 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
qDebug() << "main window start";
|
||||
|
||||
|
||||
|
||||
//实例化QNetworkAccessManager
|
||||
networkManager=new QNetworkAccessManager(this);
|
||||
//设置get请求数据完成时回调函数getData(QNetworkReply*)
|
||||
connect(networkManager,SIGNAL(finished(QNetworkReply*)),this,SLOT(getData(QNetworkReply *)));
|
||||
|
||||
//创建请求对象
|
||||
QNetworkRequest request=QNetworkRequest(QUrl("https://api.airmap.com/elevation/v1/ele/?points=30,32"));
|
||||
//发送get请求
|
||||
networkManager->get(request);
|
||||
}
|
||||
|
||||
//对返回的数据进行处理
|
||||
void MainWindow::getData(QNetworkReply *reply)
|
||||
{
|
||||
//获得返回数据存在字节数组中
|
||||
QByteArray data=reply->readAll();
|
||||
//将字节数组转为字符串
|
||||
QString str=QString::fromUtf8(data);
|
||||
//将数据展示在textEdit中
|
||||
qDebug() << str;
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
@@ -339,15 +364,14 @@ void MainWindow::keyPressEvent(QKeyEvent *event) //键盘按下事件
|
||||
break;
|
||||
case Qt::Key_Space :
|
||||
{
|
||||
//internals::PointLatLng LatLng;
|
||||
//map->SetCurrentPosition(LatLng);
|
||||
|
||||
}
|
||||
break;
|
||||
case Qt::Key_Equal :
|
||||
{
|
||||
if(event->modifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
//map->WPFind(rechcount)->SetReached(true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -359,9 +383,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) //键盘按下事件
|
||||
{
|
||||
if(event->modifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
//map->WPFind(rechcount)->SetReached(true);
|
||||
//rechcount++;
|
||||
//qDebug() << rechcount;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -369,9 +391,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) //键盘按下事件
|
||||
{
|
||||
if(event->modifiers() == Qt::ShiftModifier)
|
||||
{
|
||||
//map->WPFind(rechcount)->SetReached(true);
|
||||
//rechcount--;
|
||||
//qDebug() << rechcount;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -383,7 +403,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) //键盘按下事件
|
||||
{
|
||||
if(event->modifiers() == Qt::AltModifier)
|
||||
{
|
||||
//map->UAV->DeleteTrail();
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -458,9 +478,6 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
||||
missionUI->hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if((index == 2)||(index == 3)) map->show();
|
||||
else map->hide();
|
||||
|
||||
@@ -485,6 +502,16 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MainWindow::showMessage(const QString &message, int TimeOut)
|
||||
{
|
||||
menuBarUI->showMessage(message,TimeOut);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindow::updateUI()//事件驱动式更新数据
|
||||
{
|
||||
copk->setAttitude(dlink->mavlinknode->vehicle.attitude.pitch * 57.3,
|
||||
|
||||
+5
-4
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "QThread"
|
||||
|
||||
#include "qnavigationwidget.h"
|
||||
#include "opmapwidget.h"
|
||||
#include "Cockpit.h"
|
||||
#include "dlink.h"
|
||||
@@ -63,7 +62,7 @@ public:
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
protected slots:
|
||||
|
||||
@@ -84,6 +83,7 @@ private slots:
|
||||
|
||||
protected slots:
|
||||
|
||||
void getData(QNetworkReply *reply);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -93,8 +93,6 @@ protected:
|
||||
CheckUI *checkUI = nullptr;
|
||||
propertyui *missionUI = nullptr;
|
||||
|
||||
|
||||
QNavigationWidget *nav = nullptr;
|
||||
mapcontrol::OPMapWidget *map = nullptr;
|
||||
|
||||
DLink *dlink = nullptr;
|
||||
@@ -110,6 +108,9 @@ protected:
|
||||
|
||||
QTimer *updateTimer;
|
||||
|
||||
QNetworkAccessManager *networkManager = nullptr;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user