添加仪表上方信息显示,修改指令增加翻页
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "MenuBarUI.h"
|
||||
#include "MenuBarUI.h"
|
||||
#include "ui_MenuBarUI.h"
|
||||
|
||||
|
||||
@@ -16,15 +16,28 @@ MenuBarUI::MenuBarUI(QWidget *parent) :
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
timeRecord = new QDateTime();
|
||||
|
||||
timeRecord->setTime(QDateTime::currentDateTime().time());
|
||||
|
||||
qDebug() << "time" << timeRecord->time();
|
||||
|
||||
|
||||
|
||||
ui->label_RecordTime->setText("00:00:00");
|
||||
|
||||
|
||||
recordTimer = new QTimer(this);
|
||||
recordTimer->setInterval(1000);
|
||||
connect(recordTimer,SIGNAL(timeout()),
|
||||
this,SLOT(RecordTimeOut()));
|
||||
|
||||
|
||||
MessageTimer = new QTimer(this);
|
||||
|
||||
connect(MessageTimer,SIGNAL(timeout()),
|
||||
this,SLOT(MessageTimeOut()));
|
||||
|
||||
|
||||
|
||||
|
||||
showMessage(tr("Starting...\n"),5000);
|
||||
|
||||
|
||||
@@ -37,6 +50,7 @@ MenuBarUI::MenuBarUI(QWidget *parent) :
|
||||
|
||||
|
||||
|
||||
//setArm(true);
|
||||
}
|
||||
|
||||
MenuBarUI::~MenuBarUI()
|
||||
@@ -202,9 +216,53 @@ void MenuBarUI::MessageTimeOut(void)
|
||||
}
|
||||
|
||||
|
||||
void MenuBarUI::RecordTimeOut(void)
|
||||
{
|
||||
ui->label_RecordTime->setText(QTime::fromMSecsSinceStartOfDay(timeRecord->time().msecsTo(QDateTime::currentDateTime().time())).toString("HH:mm:ss"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MenuBarUI::setTargetPoint(int Value)
|
||||
{
|
||||
ui->label_TargetPoint->setText(QString::number(Value,'f',0));
|
||||
}
|
||||
|
||||
void MenuBarUI::setTargetAlt(float Value)
|
||||
{
|
||||
ui->label_TargteAlt->setText(QString::number(Value,'f',1));
|
||||
}
|
||||
|
||||
void MenuBarUI::setX(float Value)
|
||||
{
|
||||
ui->label_X->setText(QString::number(Value,'f',1));
|
||||
}
|
||||
|
||||
void MenuBarUI::setHeading(float Value)
|
||||
{
|
||||
ui->label_Heading->setText(QString::number(Value,'f',1));
|
||||
}
|
||||
|
||||
void MenuBarUI::setTagetAirspeed(float Value)
|
||||
{
|
||||
ui->label_TargetAirSpeed->setText(QString::number(Value,'f',1));
|
||||
}
|
||||
|
||||
void MenuBarUI::setArm(bool Value)//解锁
|
||||
{
|
||||
if(Value)
|
||||
{
|
||||
timeRecord->setTime(QDateTime::currentDateTime().time());
|
||||
if(recordTimer->isActive())
|
||||
{
|
||||
recordTimer->stop();
|
||||
}
|
||||
|
||||
recordTimer->start();
|
||||
}
|
||||
else
|
||||
{
|
||||
recordTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef MENUBARUI_H
|
||||
#ifndef MENUBARUI_H
|
||||
#define MENUBARUI_H
|
||||
|
||||
#include <QWidget>
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QBitmap>
|
||||
#include "QTimer"
|
||||
|
||||
#include "QDateTime"
|
||||
|
||||
#include <QCommonStyle>
|
||||
#include "QStyle"
|
||||
@@ -41,6 +42,15 @@ public slots:
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
void clearMessage();
|
||||
|
||||
|
||||
|
||||
void setTargetPoint(int Value);
|
||||
void setTargetAlt(float Value);
|
||||
void setX(float Value);
|
||||
void setHeading(float Value);
|
||||
void setTagetAirspeed(float Value);
|
||||
void setArm(bool Value);
|
||||
|
||||
signals:
|
||||
|
||||
void IndexChanged(int);
|
||||
@@ -52,6 +62,10 @@ private slots:
|
||||
void onClicked(void);
|
||||
|
||||
void MessageTimeOut(void);
|
||||
void RecordTimeOut(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void on_pushButton_Setting_clicked();
|
||||
@@ -71,6 +85,10 @@ private:
|
||||
|
||||
QTimer *MessageTimer = nullptr;
|
||||
|
||||
QTimer *recordTimer = nullptr;
|
||||
|
||||
QDateTime *timeRecord = nullptr;
|
||||
|
||||
};
|
||||
|
||||
#endif // MENUBARUI_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.QWidget {
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
|
||||
.QLabel {
|
||||
.QLabel#label_Status{
|
||||
background-color: white;
|
||||
background-attachment: scroll;
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
|
||||
}
|
||||
|
||||
.QLabel{
|
||||
font :20px;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.QPushButton[state="0"]{
|
||||
font :20px;
|
||||
|
||||
|
||||
+158
-2
@@ -9,7 +9,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>858</width>
|
||||
<width>1074</width>
|
||||
<height>85</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -59,10 +59,166 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_Status">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>340</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="label_Heading">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_X">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>目标空速</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>侧偏距</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>方位</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>目标高度</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>目标航点</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_TargteAlt">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label_RecordTime">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_TargetPoint">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_TargetAirSpeed">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(189, 189, 189);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>飞行时间</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user