优化tools 相关代码

This commit is contained in:
hm
2021-01-07 10:55:02 +08:00
parent 5410b1302f
commit a5beda4906
27 changed files with 190 additions and 826 deletions
+1 -62
View File
@@ -2,11 +2,10 @@
#include "ui_ServoSystem.h"
ServoSystem::ServoSystem(QWidget *parent) :
QWidget(parent),
ToolsWidget(parent),
ui(new Ui::ServoSystem)
{
ui->setupUi(this);
m_parent = parent;
setWindowTitle(tr("ServoSyste"));
@@ -61,58 +60,6 @@ ServoSystem::~ServoSystem()
}
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);
this->show();
}
else
{
this->setParent(m_parent);
this->setGeometry(m_parent->geometry());
this->move(0,0);
this->show();
update();
}
}
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_28->setText(QString::number((int16_t)t->BAT1_low_temp_degC)+ "/" + QString::number((int16_t)t->BAT1_hi_temp_degC));
@@ -166,15 +113,7 @@ void ServoSystem::setCheckState(uint32_t pos,QVariant value)
case 11:
setColor(ui->checkBox_slide,(value.toBool())?(state::success):(state::failure));
break;
}
//qDebug() << pos << value;
}
void ServoSystem::setServoState(mavlink_servo_output_raw_t t)