添加伺服系统

This commit is contained in:
hm
2020-10-07 19:50:45 +08:00
parent 8e1807c8f2
commit 3b9e229b15
18 changed files with 850 additions and 377 deletions
+107 -7
View File
@@ -6,7 +6,9 @@ PowerSystem::PowerSystem(QWidget *parent) :
ui(new Ui::PowerSystem)
{
ui->setupUi(this);
par = parent;
m_parent = parent;
setWindowTitle(tr("PowerSyste"));
//load qss
QFile file(":/qss/PowerSystem.qss");
@@ -92,6 +94,27 @@ PowerSystem::PowerSystem(QWidget *parent) :
ui->comboBox_rate->setCurrentIndex(-1);
ui->comboBox_TestPoint->addItem("核心机主燃油泵",0);
ui->comboBox_TestPoint->addItem("加力主燃油泵",1);
ui->comboBox_TestPoint->addItem("加力点火燃油泵",2);
ui->comboBox_TestPoint->addItem("尾喷口舵机",3);
ui->comboBox_TestPoint->addItem("点火器",4);
ui->comboBox_TestPoint->addItem("启动控制器1",5);
ui->comboBox_TestPoint->addItem("启动控制器2",6);
ui->comboBox_TestPoint->addItem("核心机点火油阀",7);
ui->comboBox_TestPoint->addItem("核心机优先油阀",8);
ui->comboBox_TestPoint->addItem("核心机轻吹油阀",9);
ui->comboBox_TestPoint->addItem("核心机启动气阀",10);
ui->comboBox_TestPoint->addItem("核心机主油阀",11);
ui->comboBox_TestPoint->addItem("加力主油阀",12);
ui->comboBox_TestPoint->addItem("加力轻吹阀",13);
ui->comboBox_TestPoint->addItem("加力点火快速阀",14);
ui->comboBox_TestPoint->addItem("手动转速控制",15);
ui->comboBox_TestPoint->setCurrentIndex(-1);
ui->comboBox_TestValue->show();
ui->comboBox_TestValue->setCurrentIndex(-1);
}
PowerSystem::~PowerSystem()
@@ -99,11 +122,7 @@ PowerSystem::~PowerSystem()
delete ui;
}
void PowerSystem::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void PowerSystem::mousePressEvent(QMouseEvent *event)
{
@@ -113,6 +132,11 @@ void PowerSystem::mousePressEvent(QMouseEvent *event)
}
}
void PowerSystem::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void PowerSystem::contextMenuEvent(QContextMenuEvent *event)
{
@@ -141,7 +165,7 @@ void PowerSystem::setFloat(void)
}
else
{
this->setParent(par);
this->setParent(m_parent);
this->move(0,0);
}
this->show();
@@ -264,5 +288,81 @@ void PowerSystem::setTurbineState(mavlink_turbinestate_t *t)
}
void PowerSystem::on_comboBox_TestPoint_currentIndexChanged(int index)
{
switch (index) {
case 0:
case 1:
case 2:
case 15:
ui->label_TestValue->show();
ui->label_TestValue->setText("转速");
ui->comboBox_TestValue->show();
ui->comboBox_TestValue->clear();
ui->comboBox_TestValue->addItem("10000",10000);
ui->comboBox_TestValue->addItem("15000",15000);
ui->comboBox_TestValue->addItem("20000",20000);
ui->comboBox_TestValue->addItem("25000",25000);
ui->comboBox_TestValue->addItem("30000",30000);
ui->comboBox_TestValue->addItem("35000",35000);
ui->comboBox_TestValue->addItem("40000",40000);
ui->comboBox_TestValue->addItem("45000",45000);
ui->comboBox_TestValue->setEditable(true);
ui->comboBox_TestValue->setCurrentIndex(0);
break;
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
ui->label_TestValue->show();
ui->label_TestValue->setText("电平");
ui->comboBox_TestValue->show();
ui->comboBox_TestValue->clear();
ui->comboBox_TestValue->addItem("低电平",0);
ui->comboBox_TestValue->addItem("高电平",1);
ui->comboBox_TestValue->setEditable(true);
ui->comboBox_TestValue->setCurrentIndex(1);
break;
case 4:
ui->label_TestValue->hide();
ui->comboBox_TestValue->hide();
break;
}
}
void PowerSystem::on_pushButton_SendTest_clicked()
{
float testPoint = 0;
float testValue = 0;
if(!ui->comboBox_TestValue->isHidden())//显示
{
testPoint = ui->comboBox_TestPoint->currentData(Qt::UserRole).toFloat();
testValue = ui->comboBox_TestValue->currentData(Qt::UserRole).toFloat();
}
else
{
testPoint = ui->comboBox_TestPoint->currentData(Qt::UserRole).toFloat();
}
qDebug() << "send test:" << testPoint << testValue;
}
+5 -1
View File
@@ -45,13 +45,17 @@ private slots:
void on_comboBox_TestPoint_currentIndexChanged(int index);
void on_pushButton_SendTest_clicked();
public slots:
void setFloat(void);
private:
QWidget *par;
QWidget *m_parent;
Ui::PowerSystem *ui;
};
+3 -9
View File
@@ -12,7 +12,7 @@
border-style: solid;
border-radius: 5;
padding: 3px;
font: 30px "Arial";
font: 20px "Arial";
}
.QPushButton:pressed {
@@ -20,14 +20,8 @@
stop: 0 #dadbde, stop: 1 #f6f7fa);
}
.QLineEdit {
background-color: #FFFFFF;
font: 30px "Arial";
}
.QLabel {
font: 30px "Arial";
font: 20px "Arial";
}
.QLabel[state="0"] {
@@ -42,7 +36,7 @@
.QComboBox {
background-color: #FFFFFF;
font: 30px "Arial";
font: 20px "Arial";
}
.QCheckBox{
+46 -6
View File
@@ -140,25 +140,25 @@
<set>Qt::AlignCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="1">
<widget class="QComboBox" name="comboBox_5"/>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton_11">
<widget class="QPushButton" name="pushButton_SendTest">
<property name="text">
<string>测试</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_59">
<widget class="QLabel" name="label_TestValue">
<property name="text">
<string>测试值</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox_TestValue"/>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_4"/>
<widget class="QComboBox" name="comboBox_TestPoint"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_58">
@@ -167,6 +167,16 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -219,6 +229,9 @@
</property>
<item row="4" column="3">
<widget class="QLabel" name="label_T5">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -240,6 +253,9 @@
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_RS">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -268,6 +284,9 @@
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_RM">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -275,6 +294,9 @@
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_RPM_des">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -289,6 +311,9 @@
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_P5t">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -303,6 +328,9 @@
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_NMS">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -310,6 +338,9 @@
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_P1t">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -317,6 +348,9 @@
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_CR">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -324,6 +358,9 @@
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_T1t">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
@@ -331,6 +368,9 @@
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_RPM_mea">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string/>
</property>
+83 -1
View File
@@ -1,4 +1,4 @@
#include "ServoSystem.h"
#include "ServoSystem.h"
#include "ui_ServoSystem.h"
ServoSystem::ServoSystem(QWidget *parent) :
@@ -6,9 +6,91 @@ ServoSystem::ServoSystem(QWidget *parent) :
ui(new Ui::ServoSystem)
{
ui->setupUi(this);
m_parent = parent;
setWindowTitle(tr("ServoSyste"));
//load qss
QFile file(":/qss/ServoSystem.qss");
file.open(QFile::ReadOnly);
QTextStream filetext(&file);
QString stylesheet = filetext.readAll();
this->setStyleSheet(stylesheet);
file.close();
//========
setColor(ui->checkBox_Ground,state::success);
setColor(ui->checkBox_onBoard,state::success);
setColor(ui->checkBox_28v,state::success);
setColor(ui->checkBox_56v,state::success);
setColor(ui->checkBox_AirSpeed,state::success);
setColor(ui->checkBox_500W,state::success);
}
ServoSystem::~ServoSystem()
{
delete ui;
}
void ServoSystem::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void ServoSystem::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = new QMenu(this);
QAction *pAction = new QAction("float",this);
connect(pAction,SIGNAL(triggered(bool)),
this,SLOT(setFloat()));
menu->addAction(pAction);
menu->move(cursor().pos());
menu->show();
}
void ServoSystem::setFloat(void)
{
if(this->parent())
{
this->setParent(nullptr);
}
else
{
this->setParent(m_parent);
this->move(0,0);
}
this->show();
}
void ServoSystem::setColor(QWidget *w,state s)
{
w->setProperty("state",s);
w->style()->unpolish(w);
w->style()->polish(w);
}
void ServoSystem::setValue(QLabel *w,QString s)
{
w->setText(s);
}
void ServoSystem::setBUMState(mavlink_bmustate_t *t)
{
ui->label_temp->setText(QString::number(t->BAT1_hi_temp_degC) + "");
ui->label_onBoard_28V_Voltage->setText(QString::number(t->BAT1_group_voltage_mv));
ui->label_onBoard_28V_Current->setText(QString::number(t->BAT1_group_current_dA));
ui->label_onBoard_56V_Voltage->setText(QString::number(t->BAT2_group_voltage_mv));
ui->label_onBoard_56V_Current->setText(QString::number(t->BAT2_group_current_dA));
}
+33 -1
View File
@@ -1,7 +1,16 @@
#ifndef SERVOSYSTEM_H
#ifndef SERVOSYSTEM_H
#define SERVOSYSTEM_H
#include <QWidget>
#include "QMouseEvent"
#include "QDebug"
#include "QAction"
#include "QContextMenuEvent"
#include "QMenu"
#include "QColor"
#include "QLabel"
#include "mavlink.h"
#include "QStyle"
namespace Ui {
class ServoSystem;
@@ -12,10 +21,33 @@ class ServoSystem : public QWidget
Q_OBJECT
public:
enum state{
success = 0,
failure,
};
explicit ServoSystem(QWidget *parent = nullptr);
~ServoSystem();
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
private slots:
public slots:
void setFloat(void);
void setColor(QWidget *w,state s);
void setValue(QLabel *w,QString s);
void setBUMState(mavlink_bmustate_t *t);
private:
QWidget *m_parent;
Ui::ServoSystem *ui;
};
+11 -2
View File
@@ -16,8 +16,17 @@ HEADERS += \
SOURCES += \
$$PWD/ServoSystem.cpp
RESOURCES += \
$$PWD/ServoSystem.qrc
INCLUDEPATH += $$PWD/../mavlink \
$$PWD/../mavlink/ardupilotmega \
$$PWD/../mavlink/common \
$$PWD/../mavlink/icarous \
$$PWD/../mavlink/uAvionix \
$$PWD/../mavlink/XYK \
$$PWD/../mavlink/message_definitions
+9
View File
@@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/qss">
<file>ServoSystem.qss</file>
</qresource>
<qresource prefix="/img">
<file>fail.png</file>
<file>normal.png</file>
</qresource>
</RCC>
+60
View File
@@ -0,0 +1,60 @@
.QFrame {
background-color: #FFFFFF;
}
.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"] {
image:url(:/img/normal.png);
}
.QLabel[state="1"] {
image:url(:/img/fail.png);
}
.QComboBox {
background-color: #FFFFFF;
font: 20px "Arial";
}
.QCheckBox{
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);
}
+168 -168
View File
@@ -7,21 +7,81 @@
<x>0</x>
<y>0</y>
<width>649</width>
<height>420</height>
<height>471</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>621</width>
<height>191</height>
</rect>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>舵机</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_Servo_Read">
<property name="text">
<string>状态查询</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButton_Servo_Zero">
<property name="text">
<string>舵面找零</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_Servo_Check">
<property name="text">
<string>地面自检</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_Servo_Work">
<property name="text">
<string>工作模式</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>电源</string>
</property>
@@ -29,6 +89,44 @@
<set>Qt::AlignCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_56V_On">
<property name="text">
<string>56V供电打开</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pushButton_56V_Off">
<property name="text">
<string>56V供电关闭</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="pushButton_AirHeatOff">
<property name="text">
<string>空速加热关闭</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="pushButton_AirHeatOn">
<property name="text">
<string>空速加热打开</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_temp">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -36,92 +134,28 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>56V供电打开</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>56V供电关闭</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>地面28V电压</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>地面28V电流</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_6">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>空速加热打开</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>空速加热关闭</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>机载28V电压</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_10">
<item row="1" column="1">
<widget class="QLabel" name="label_onBoard_28V_Voltage">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>机载28V电流</string>
<item row="3" column="3">
<widget class="QLabel" name="label_onBoard_56V_Current">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>0</string>
</property>
@@ -130,14 +164,7 @@
<item row="3" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>机载58V电压</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_14">
<property name="text">
<string>0</string>
<string>机载56V电压</string>
</property>
</widget>
</item>
@@ -148,118 +175,91 @@
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_13">
<item row="3" column="1">
<widget class="QLabel" name="label_onBoard_56V_Voltage">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox">
<item row="1" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>地面电源</string>
<string>机载28V电流</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>机载电源</string>
<item row="1" column="3">
<widget class="QLabel" name="label_onBoard_28V_Current">
<property name="styleSheet">
<string notr="true">background-color: rgb(205, 205, 205);</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>28V电源</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>56V电源</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QCheckBox" name="checkBox_5">
<property name="text">
<string>空速管加热</string>
<string>0</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>20</x>
<y>220</y>
<width>581</width>
<height>141</height>
</rect>
</property>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>舵机</string>
<string>状态</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QPushButton" name="pushButton_5">
<property name="geometry">
<rect>
<x>50</x>
<y>20</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="1">
<widget class="QCheckBox" name="checkBox_onBoard">
<property name="text">
<string>PushButton</string>
<string>机载电源</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_6">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>75</width>
<height>23</height>
</rect>
</property>
</item>
<item row="0" column="3">
<widget class="QCheckBox" name="checkBox_56v">
<property name="text">
<string>PushButton</string>
<string>56V电源</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_7">
<property name="geometry">
<rect>
<x>240</x>
<y>20</y>
<width>75</width>
<height>23</height>
</rect>
</property>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="checkBox_28v">
<property name="text">
<string>PushButton</string>
<string>28V电源</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_8">
<property name="geometry">
<rect>
<x>330</x>
<y>20</y>
<width>75</width>
<height>23</height>
</rect>
</property>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_Ground">
<property name="text">
<string>PushButton</string>
<string>地面电源</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QCheckBox" name="checkBox_AirSpeed">
<property name="text">
<string>空速管加热</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QCheckBox" name="checkBox_500W">
<property name="text">
<string>500W大功率打开</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+125 -20
View File
@@ -16,6 +16,18 @@ ToolsUI::ToolsUI(QWidget *parent) :
this->setStyleSheet(stylesheet);
file.close();
int w = 120;
int h = 50;
ui->pushButton_Inspector->setFixedSize(w,h);
ui->pushButton_Log->setFixedSize(w,h);
ui->pushButton_Replay->setFixedSize(w,h);
ui->pushButton_Console->setFixedSize(w,h);
ui->pushButton_Servos->setFixedSize(w,h);
ui->PowerSystem->setFixedSize(w,h);
ui->ServoSystem->setFixedSize(w,h);
index0 = new Tools_Index0(ui->frame);
index1 = new Tools_Index1(ui->frame);
@@ -99,33 +111,126 @@ void ToolsUI::resizeEvent(QResizeEvent *event)
void ToolsUI::onTabIndexChanged(const int &index)//界面选择管理
{
if(index == 0) index0->show();
else index0->hide();
if(index == 1) index1->show();
else index1->hide();
if(index == 2) index2->show();
else index2->hide();
if(index == 3) index3->show();
else index3->hide();
if(index == 4) index4->show();
if(index == 0)
{
if(index0->parent())
{
index0->show();
}
else
{
if(index4->isFloat() == false)
index0->showNormal();
index0->activateWindow();
}
}
else {
if(index0->parent())
{
index0->hide();
}
}
if(index == 1)
{
if(index1->parent())
{
index1->show();
}
else
{
index1->showNormal();
index1->activateWindow();
}
}
else {
if(index1->parent())
index1->hide();
}
if(index == 2)
{
if(index2->parent())
{
index2->show();
}
else
{
index2->showNormal();
index2->activateWindow();
}
}
else {
if(index2->parent())
index2->hide();
}
if(index == 3)
{
if(index3->parent())
{
index3->show();
}
else
{
index3->showNormal();
index3->activateWindow();
}
}
else {
if(index3->parent())
index3->hide();
}
if(index == 4)
{
if(index4->parent())
{
index4->show();
}
else
{
index4->showNormal();
index4->activateWindow();
}
}
else {
if(index4->parent())
index4->hide();
}
if(index == 5)
{
if(powersystem->parent())
{
powersystem->show();
}
else
{
powersystem->showNormal();
powersystem->activateWindow();
}
}
else {
if(powersystem->parent())
powersystem->hide();
}
if(index == 5) powersystem->show();
else powersystem->hide();
if(index == 6) servosystem->show();
else servosystem->hide();
if(index == 6)
{
if(servosystem->parent())
{
servosystem->show();
}
else
{
servosystem->showNormal();
servosystem->activateWindow();
}
}
else {
if(servosystem->parent())
servosystem->hide();
}
}
+22 -22
View File
@@ -27,14 +27,14 @@
<widget class="QPushButton" name="pushButton_Replay">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>80</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
@@ -46,8 +46,8 @@
<widget class="QPushButton" name="pushButton_Servos">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
@@ -59,14 +59,14 @@
<widget class="QPushButton" name="pushButton_Log">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>80</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
@@ -78,14 +78,14 @@
<widget class="QPushButton" name="pushButton_Console">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>80</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
@@ -110,14 +110,14 @@
<widget class="QPushButton" name="pushButton_Inspector">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>80</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
@@ -129,8 +129,8 @@
<widget class="QPushButton" name="PowerSystem">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
@@ -142,8 +142,8 @@
<widget class="QPushButton" name="ServoSystem">
<property name="minimumSize">
<size>
<width>120</width>
<height>80</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
+42 -6
View File
@@ -1,4 +1,4 @@
#include "tools_Index0.h"
#include "tools_Index0.h"
#include "ui_tools_Index0.h"
Tools_Index0::Tools_Index0(QWidget *parent) :
@@ -6,6 +6,9 @@ Tools_Index0::Tools_Index0(QWidget *parent) :
ui(new Ui::Tools_Index0)
{
ui->setupUi(this);
m_parent = parent;
setWindowTitle(tr("MavlinkInspector"));
//load qss
QFile file(":/qss/ToolsUI.qss");
@@ -30,6 +33,44 @@ Tools_Index0::~Tools_Index0()
delete ui;
}
void Tools_Index0::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void Tools_Index0::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = new QMenu(this);
QAction *pAction = new QAction("float",this);
connect(pAction,SIGNAL(triggered(bool)),
this,SLOT(setFloat()));
menu->addAction(pAction);
menu->move(cursor().pos());
menu->show();
}
void Tools_Index0::setFloat(void)
{
if(this->parent())
{
this->setParent(nullptr);
this->resize(800,480);
}
else
{
this->setParent(m_parent);
this->setGeometry(m_parent->geometry());
this->move(0,0);
}
this->show();
}
void Tools_Index0::resizeEvent(QResizeEvent *event)
{
@@ -38,22 +79,17 @@ void Tools_Index0::resizeEvent(QResizeEvent *event)
{
mavlinkinspector->setGeometry(0,0,ui->frame->width(),ui->frame->height());
}
update();
}
void Tools_Index0::setInstallWidget(QWidget *w)
{
Inspect = w;
Inspect->setParent(this);
if(Inspect)
{
//qDebug() << "install param inspector";
Inspect->setGeometry(0,0,ui->frame->width(),ui->frame->height());
Inspect->show();
}
+18 -7
View File
@@ -1,4 +1,4 @@
#ifndef TOOLS_INDEX0_H
#ifndef TOOLS_INDEX0_H
#define TOOLS_INDEX0_H
#include <QWidget>
@@ -9,7 +9,17 @@
#include "MAVLinkInspector.h"
//#include "Scope.h"
#include "QMouseEvent"
#include "QDebug"
#include "QAction"
#include "QContextMenuEvent"
#include "QMenu"
#include "QColor"
#include "QLabel"
#include "mavlink.h"
#include "QStyle"
#include <QScreen>
namespace Ui {
class Tools_Index0;
@@ -26,19 +36,20 @@ public:
void resizeEvent(QResizeEvent *event);
MAVLinkInspector *mavlinkinspector = nullptr;
public slots:
void setInstallWidget(QWidget *w);
private slots:
signals:
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void setFloat(void);
private:
QWidget *m_parent;
Ui::Tools_Index0 *ui;
QWidget *Inspect = nullptr;
+25 -31
View File
@@ -39,40 +39,44 @@ tools_Index4::~tools_Index4()
}
void tools_Index4::closeEvent(QCloseEvent *event)
{
qDebug() << event;
this->setParent(m_parent);
setWindowFlags(Qt::Widget);
this->setGeometry(m_parent->geometry());
//this->setGeometry(0,0,m_parent->geometry().width(),m_parent->geometry().height());
this->move(0,10);
this->show();
setFloat(false);
qDebug() << "DoubleClick" << event;
setFloat();
event->ignore();
}
void tools_Index4::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = new QMenu(this);
void tools_Index4::mouseMoveEvent(QMouseEvent *event)
QAction *pAction = new QAction("float",this);
connect(pAction,SIGNAL(triggered(bool)),
this,SLOT(setFloat()));
menu->addAction(pAction);
menu->move(cursor().pos());
menu->show();
}
void tools_Index4::setFloat(void)
{
if(this->parent())
{
this->setParent(nullptr);
this->setWindowFlags(Qt::Dialog);
this->move(0,10);
this->show();
setFloat(true);
}
qDebug() << "Move" << event;
else
{
this->setParent(m_parent);
this->setGeometry(m_parent->geometry());
this->move(0,0);
}
this->show();
}
void tools_Index4::mouseReleaseEvent(QMouseEvent *event)
{
qDebug() << "clicked";
@@ -101,17 +105,7 @@ void tools_Index4::mouseReleaseEvent(QMouseEvent *event)
void tools_Index4::mouseDoubleClickEvent(QMouseEvent *event)
{
this->setParent(m_parent);
setWindowFlags(Qt::Widget);
this->setGeometry(m_parent->geometry());
//this->setGeometry(0,0,m_parent->geometry().width(),m_parent->geometry().height());
this->move(0,10);
this->show();
setFloat(false);
qDebug() << "DoubleClick" << event;
}
void tools_Index4::loadCommandJson(const QString& jsonFilename)
+13 -16
View File
@@ -14,6 +14,15 @@
#include "QJsonObject"
#include "QJsonParseError"
#include "QMouseEvent"
#include "QDebug"
#include "QAction"
#include "QContextMenuEvent"
#include "QMenu"
#include "QColor"
#include "QLabel"
#include "mavlink.h"
#include "QStyle"
namespace Ui {
class tools_Index4;
@@ -27,33 +36,21 @@ public:
explicit tools_Index4(QWidget *parent = nullptr);
~tools_Index4();
void setFloat(bool value)
{
Floated = value;
update();
}
bool isFloat(void)
{
return Floated;
}
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
public slots:
void setFloat(void);
void setChannel(int port,uint16_t *value);
void loadCommandJson(const QString& jsonFilename);
void setRange(QJsonArray min,QJsonArray max);
protected:
void closeEvent(QCloseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
private: