添加evtol界面
@@ -0,0 +1,154 @@
|
||||
#include "evtol.h"
|
||||
#include "ui_evtol.h"
|
||||
|
||||
evtol::evtol(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::evtol)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_parent = parent;
|
||||
|
||||
QFile file(":/qss/evtol.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
QTextStream filetext(&file);
|
||||
QString stylesheet = filetext.readAll();
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
|
||||
setWindowTitle(tr("evtol"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
evtol::~evtol()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void evtol::setColor(QWidget *w,state s)
|
||||
{
|
||||
w->setProperty("state",s);
|
||||
w->style()->unpolish(w);
|
||||
w->style()->polish(w);
|
||||
}
|
||||
|
||||
void evtol::setValue(QLabel *w,QString s)
|
||||
{
|
||||
w->setText(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void evtol::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void evtol::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
setFloat();
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void evtol::setFloat(void)
|
||||
{
|
||||
if(this->parent())
|
||||
{
|
||||
this->setParent(nullptr);
|
||||
QScreen *screen=QGuiApplication::primaryScreen ();;
|
||||
this->move((screen->availableGeometry().width()-this->width())/2,(screen->availableGeometry().height()-this->height())/2);
|
||||
this->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setParent(m_parent);
|
||||
this->setGeometry(m_parent->geometry());
|
||||
this->move(0,0);
|
||||
this->hide();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void evtol::setRotor(uint32_t pos,QVariant value1)
|
||||
{
|
||||
|
||||
switch (pos) {
|
||||
|
||||
case 1:
|
||||
if(value1.toInt() >= 5000)
|
||||
{
|
||||
ui->progressBar_1->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_1->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_1,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 2:
|
||||
ui->progressBar_2->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_2,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 3:
|
||||
ui->progressBar_3->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_3,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 4:
|
||||
ui->progressBar_4->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_4,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 5:
|
||||
ui->progressBar_5->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_5,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 6:
|
||||
if(value1.toInt() >= 5000)
|
||||
{
|
||||
ui->progressBar_6->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_6->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_6,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 7:
|
||||
ui->progressBar_7->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_7,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 8:
|
||||
ui->progressBar_8->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_8,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 9:
|
||||
ui->progressBar_9->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_9,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
case 10:
|
||||
ui->progressBar_10->setValue(value1.toInt());
|
||||
|
||||
setColor( ui->progressBar_10,(value1 < 0)?(state::failure):(state::success));
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef EVTOL_H
|
||||
#define EVTOL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "QMouseEvent"
|
||||
#include "QDebug"
|
||||
#include "QAction"
|
||||
#include "QContextMenuEvent"
|
||||
#include "QMenu"
|
||||
#include "QColor"
|
||||
#include "QLabel"
|
||||
#include "mavlink.h"
|
||||
#include "QStyle"
|
||||
#include "QDebug"
|
||||
#include "QScreen"
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace Ui {
|
||||
class evtol;
|
||||
}
|
||||
|
||||
class evtol : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
enum state{
|
||||
success = 0,
|
||||
failure = 1,
|
||||
warning = 2,
|
||||
inital = 3,
|
||||
};
|
||||
|
||||
explicit evtol(QWidget *parent = nullptr);
|
||||
~evtol();
|
||||
|
||||
public slots:
|
||||
void setFloat(void);
|
||||
|
||||
|
||||
void setRotor(uint32_t pos,QVariant value1);
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
void setColor(QWidget *w,state s);
|
||||
void setValue(QLabel *w,QString s);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
private:
|
||||
Ui::evtol *ui;
|
||||
QWidget *m_parent;
|
||||
};
|
||||
|
||||
#endif // EVTOL_H
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
QT += opengl
|
||||
QT += network
|
||||
QT += sql
|
||||
QT += svg
|
||||
QT += quickwidgets
|
||||
QT += quick
|
||||
QT += qml
|
||||
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/evtol.qrc
|
||||
|
||||
|
||||
INCLUDEPATH += $$PWD/../mavlink \
|
||||
$$PWD/../mavlink/ardupilotmega \
|
||||
$$PWD/../mavlink/common \
|
||||
$$PWD/../mavlink/icarous \
|
||||
$$PWD/../mavlink/uAvionix \
|
||||
$$PWD/../mavlink/XYK \
|
||||
$$PWD/../mavlink/message_definitions
|
||||
|
||||
FORMS += \
|
||||
$$PWD/evtol.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/evtol.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/evtol.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qss">
|
||||
<file>evtol.qss</file>
|
||||
</qresource>
|
||||
<qresource prefix="/img">
|
||||
<file>fail.png</file>
|
||||
<file>normal.png</file>
|
||||
<file>fail_rect.png</file>
|
||||
<file>success_rect.png</file>
|
||||
<file>warning_rect.png</file>
|
||||
<file>evtol_c.png</file>
|
||||
<file>evtol_w.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -0,0 +1,86 @@
|
||||
|
||||
|
||||
.QFrame {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.QProgressBar::chunk[state="0"]{
|
||||
background-color: #00FF00;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.QProgressBar::chunk[state="1"]{
|
||||
background-color: #FF0000;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.QPushButton {
|
||||
background-color: #FFFFFF /*palegoldenrod*/;
|
||||
border-width: 2px;
|
||||
border-color: darkkhaki;
|
||||
border-style: solid;
|
||||
border-radius: 5;
|
||||
padding: 3px;
|
||||
font: 20px "Arial";
|
||||
}
|
||||
|
||||
.QPushButton:pressed {
|
||||
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #dadbde, stop: 1 #f6f7fa);
|
||||
}
|
||||
|
||||
.QLabel {
|
||||
font: 20px "Arial";
|
||||
}
|
||||
|
||||
.QLabel[state="0"] {
|
||||
border-image:url(:/img/success_rect.png);
|
||||
}
|
||||
|
||||
.QLabel[state="1"] {
|
||||
border-image:url(:/img/fail_rect.png);
|
||||
}
|
||||
|
||||
.QLabel[state="2"] {
|
||||
border-image:url(:/img/warning_rect.png);
|
||||
}
|
||||
|
||||
.QLabel[state="3"] {
|
||||
border-image:url(:/img/rect_gray.png);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.QComboBox {
|
||||
background-color: #FFFFFF;
|
||||
font: 20px "Arial";
|
||||
}
|
||||
|
||||
.QCheckBox{
|
||||
font: 20px "Arial";
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.QCheckBox::indicator {
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
}
|
||||
|
||||
.QCheckBox::indicator[state="0"] {
|
||||
image:url(:/img/normal.png);
|
||||
}
|
||||
|
||||
.QCheckBox::indicator[state="1"] {
|
||||
image:url(:/img/fail.png);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>evtol</class>
|
||||
<widget class="QWidget" name="evtol">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>519</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>519</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>519</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">image: url(:/img/evtol_c.png);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QProgressBar" name="progressBar_10">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>90</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>130</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>80</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>120</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>300</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>340</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>300</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>340</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-2000</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>50</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>340</y>
|
||||
<width>118</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%v</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |