优化tools 相关代码
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
#include "ui_Senser.h"
|
||||
|
||||
Senser::Senser(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ToolsWidget(parent),
|
||||
ui(new Ui::Senser)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_parent = parent;
|
||||
|
||||
QFile file(":/qss/Senser.qss");
|
||||
file.open(QFile::ReadOnly);
|
||||
@@ -23,53 +22,12 @@ Senser::~Senser()
|
||||
}
|
||||
|
||||
|
||||
void Senser::setColor(QWidget *w,state s)
|
||||
{
|
||||
w->setProperty("state",s);
|
||||
w->style()->unpolish(w);
|
||||
w->style()->polish(w);
|
||||
}
|
||||
|
||||
void Senser::setValue(QLabel *w,QString s)
|
||||
{
|
||||
w->setText(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Senser::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Senser::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
setFloat();
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void Senser::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 Senser::setINS(int source,int pos,QVariant value)
|
||||
{
|
||||
if(source == 1)
|
||||
|
||||
Reference in New Issue
Block a user