高程去airmap网站的api读取
This commit is contained in:
@@ -46,6 +46,13 @@ bool Selector::event(QEvent *event)
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void Selector::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
qDebug() << "focus out" << event;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//设置分类
|
||||
void Selector::setCategory(QStringList list)
|
||||
{
|
||||
|
||||
@@ -53,6 +53,9 @@ protected:
|
||||
|
||||
bool event(QEvent *event);
|
||||
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool isHaveCategory = false;
|
||||
|
||||
@@ -28,8 +28,6 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
|
||||
QTextCursor cursor=log_te->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
log_te->setTextCursor(cursor);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +45,19 @@ MenuBarUI::MenuBarUI(QWidget *parent) :
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
ui->textBrowser->setText( tr("Starting...\n"));
|
||||
|
||||
//log_te = ui->textBrowser;
|
||||
|
||||
//qInstallMessageHandler(myMessageOutput);
|
||||
|
||||
MessageTimer = new QTimer(this);
|
||||
|
||||
connect(MessageTimer,SIGNAL(timeout()),
|
||||
this,SLOT(MessageTimeOut()));
|
||||
|
||||
|
||||
showMessage(tr("Starting...\n"),5000);
|
||||
|
||||
}
|
||||
|
||||
MenuBarUI::~MenuBarUI()
|
||||
@@ -89,3 +95,46 @@ void MenuBarUI::on_pushButton_Info_clicked()
|
||||
{
|
||||
emit IndexChanged(4);
|
||||
}
|
||||
|
||||
void MenuBarUI::showMessage(const QString &message, int TimeOut)
|
||||
{
|
||||
ui->label_Status->setText(message);
|
||||
//这句:如果小于0,那么不生成定时器,减少内存开支,因为小于0时,定时器永远不会触发
|
||||
if(TimeOut > 0)
|
||||
{
|
||||
if(MessageTimer->isActive())
|
||||
{
|
||||
MessageTimer->stop();
|
||||
}
|
||||
MessageTimer->start(TimeOut);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(MessageTimer->isActive())
|
||||
{
|
||||
MessageTimer->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MenuBarUI::clearMessage()
|
||||
{
|
||||
ui->label_Status->clear();
|
||||
}
|
||||
|
||||
|
||||
void MenuBarUI::MessageTimeOut(void)
|
||||
{
|
||||
if(MessageTimer->isActive())
|
||||
{
|
||||
MessageTimer->stop();
|
||||
}
|
||||
clearMessage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include <QtGlobal>
|
||||
#include "QFile"
|
||||
|
||||
#include "QTimer"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class MenuBarUI;
|
||||
}
|
||||
@@ -20,8 +23,8 @@ public:
|
||||
explicit MenuBarUI(QWidget *parent = nullptr);
|
||||
~MenuBarUI();
|
||||
|
||||
|
||||
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
void clearMessage();
|
||||
signals:
|
||||
|
||||
void IndexChanged(int);
|
||||
@@ -29,7 +32,7 @@ signals:
|
||||
private slots:
|
||||
void onClicked(void);
|
||||
|
||||
|
||||
void MessageTimeOut(void);
|
||||
|
||||
|
||||
void on_pushButton_Setting_clicked();
|
||||
@@ -44,6 +47,9 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::MenuBarUI *ui;
|
||||
|
||||
QTimer *MessageTimer = nullptr;
|
||||
|
||||
};
|
||||
|
||||
#endif // MENUBARUI_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.QPushButton {
|
||||
@@ -17,7 +17,7 @@
|
||||
stop: 0 #dadbde, stop: 1 #f6f7fa);
|
||||
}
|
||||
|
||||
QTextBrowser {
|
||||
QLabel {
|
||||
background-color: white;
|
||||
background-attachment: scroll;
|
||||
|
||||
@@ -29,4 +29,6 @@ QTextBrowser {
|
||||
font :20px;
|
||||
font-weight:bold;
|
||||
|
||||
text-align:AlignLeft,AlignVCenter;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>858</width>
|
||||
<height>82</height>
|
||||
<height>85</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -42,22 +42,26 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
<widget class="QLabel" name="label_Status">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -54,13 +54,13 @@ void Index0::onTabIndexChanged(const int &index)//界面选择管理
|
||||
if(index == 1) mapsetting->show();
|
||||
else mapsetting->hide();
|
||||
|
||||
//地图设置
|
||||
if(index == 2) mapsetting->show();
|
||||
else mapsetting->hide();
|
||||
//指令载入设置
|
||||
if(index == 2) {}
|
||||
else {}
|
||||
|
||||
//地图设置
|
||||
if(index == 3) mapsetting->show();
|
||||
else mapsetting->hide();
|
||||
//自检目录设置
|
||||
if(index == 3) {}
|
||||
else {}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ void Index0::on_pushButton_Map_clicked()
|
||||
emit IndexChanged(1);
|
||||
}
|
||||
|
||||
|
||||
void Index0::on_pushButton_command_clicked()
|
||||
{
|
||||
emit IndexChanged(2);
|
||||
|
||||
+2
-79
@@ -67,8 +67,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
map->setFocus();
|
||||
map->setMouseTracking(true);
|
||||
|
||||
|
||||
|
||||
map->setGeometry(0,
|
||||
0,
|
||||
this->width(),
|
||||
@@ -211,6 +209,8 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
map,SLOT(WPSetCurrent(int)),Qt::DirectConnection);
|
||||
|
||||
|
||||
menuBarUI->showMessage(tr("存在bug,连接界面udp数字输入的.可以超过3个,不合理"));
|
||||
|
||||
|
||||
qDebug() << "main window start";
|
||||
|
||||
@@ -433,29 +433,6 @@ bool MainWindow::event(QEvent *event)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindow::subui(QString arg)//子界面管理
|
||||
{
|
||||
if(arg == tr("SerialPort"))
|
||||
{
|
||||
dlink_triggered();
|
||||
}
|
||||
else if(arg == tr("UDP"))
|
||||
{
|
||||
client_triggered();
|
||||
}
|
||||
else if(arg == tr("Mavlink"))
|
||||
{
|
||||
//dlink->mavlinknode->mavlinkinspector->show();
|
||||
}
|
||||
else if(arg == tr("Parameter"))
|
||||
{
|
||||
//dlink->mavlinknode->Parameter->paramInspect->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
||||
{
|
||||
//设置
|
||||
@@ -508,60 +485,6 @@ void MainWindow::onTabIndexChanged(const int &index)//界面选择管理
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::dlink_triggered()
|
||||
{
|
||||
|
||||
/*
|
||||
if(dlink->statesPort())
|
||||
{
|
||||
disconnectdialog dlg(this);
|
||||
|
||||
dlg.setWindowTitle(tr("SerialPort"));
|
||||
dlg.setWindowIcon(QIcon("qrc:/images/LinkUI/SerialPort.ico"));
|
||||
|
||||
int ret = dlg.exec();
|
||||
if (QDialog::Accepted == ret)
|
||||
{
|
||||
dlink->stopPort();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectDialog dlg(this);
|
||||
|
||||
dlg.setWindowTitle(tr("SerialPort"));
|
||||
dlg.setWindowIcon(QIcon("qrc:/images/LinkUI/SerialPort.ico"));
|
||||
|
||||
dlg.baudrate = 115200;
|
||||
dlg.parity = QSerialPort::NoParity;
|
||||
int ret = dlg.exec();
|
||||
if (QDialog::Accepted == ret)
|
||||
{
|
||||
dlink->setupPort(dlg.port, dlg.baudrate,dlg.parity);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::client_triggered()
|
||||
{
|
||||
/*
|
||||
ClientLinkDialog dlg(this);
|
||||
|
||||
dlg.setWindowTitle(tr("ClientLink"));
|
||||
dlg.setWindowIcon(QIcon(":/images/LinkUI/Client.ico"));
|
||||
|
||||
int ret = dlg.exec();
|
||||
if (QDialog::Accepted == ret)
|
||||
{
|
||||
dlink->setupClient(dlg.remote_addr,dlg.remote_port,dlg.local_port);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updateUI()//事件驱动式更新数据
|
||||
{
|
||||
copk->setAttitude(dlink->mavlinknode->vehicle.attitude.pitch * 57.3,
|
||||
|
||||
+1
-5
@@ -64,8 +64,7 @@ public:
|
||||
|
||||
public slots:
|
||||
|
||||
void dlink_triggered();
|
||||
void client_triggered();
|
||||
|
||||
protected slots:
|
||||
|
||||
bool event(QEvent *event);
|
||||
@@ -76,9 +75,6 @@ protected slots:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
|
||||
void subui(QString arg);
|
||||
|
||||
|
||||
private slots:
|
||||
void onTabIndexChanged(const int &index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user