添加伺服系统
This commit is contained in:
@@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user