优化tools 相关代码
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
#include "ui_PowerSystem.h"
|
||||
|
||||
PowerSystem::PowerSystem(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ToolsWidget(parent),
|
||||
ui(new Ui::PowerSystem)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_parent = parent;
|
||||
|
||||
setWindowTitle(tr("PowerSyste"));
|
||||
|
||||
@@ -153,60 +152,6 @@ void PowerSystem::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void PowerSystem::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
setFloat();
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void PowerSystem::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 PowerSystem::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->show();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void PowerSystem::setColor(QWidget *w,state s)
|
||||
{
|
||||
w->setProperty("state",s);
|
||||
w->style()->unpolish(w);
|
||||
w->style()->polish(w);
|
||||
}
|
||||
|
||||
void PowerSystem::setValue(QLabel *w,QString s)
|
||||
{
|
||||
w->setText(s);
|
||||
}
|
||||
|
||||
void PowerSystem::setTurbineState(mavlink_turbinestate_t *t)
|
||||
{
|
||||
QString runState;
|
||||
|
||||
Reference in New Issue
Block a user