86 lines
1.4 KiB
C++
86 lines
1.4 KiB
C++
#include "ToolsWidget.h"
|
|
|
|
ToolsWidget::ToolsWidget(QWidget *parent) : QWidget(parent)
|
|
{
|
|
m_parent = parent;
|
|
}
|
|
|
|
ToolsWidget::~ToolsWidget()
|
|
{
|
|
|
|
}
|
|
|
|
void ToolsWidget::mousePressEvent(QMouseEvent *event)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
void ToolsWidget::setColor(QWidget *w,state s)
|
|
{
|
|
w->setProperty("state",s);
|
|
w->style()->unpolish(w);
|
|
w->style()->polish(w);
|
|
update();
|
|
}
|
|
|
|
void ToolsWidget::setValue(QLabel *w,QString s)
|
|
{
|
|
w->setText(s);
|
|
update();
|
|
}
|
|
|
|
void ToolsWidget::setFloat(void)
|
|
{
|
|
if(this->parent())
|
|
{
|
|
m_parent = qobject_cast<QWidget *>(this->parent());
|
|
|
|
QPoint pos = mapToGlobal(m_parent->pos());
|
|
|
|
this->setParent(nullptr);
|
|
this->resize(this->minimumSize());
|
|
this->move(pos.x() + (m_parent->width() - this->width()) * 0.5,
|
|
pos.y());
|
|
|
|
if(Top())
|
|
{
|
|
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint);
|
|
}
|
|
|
|
this->show();
|
|
}
|
|
else
|
|
{
|
|
if(m_parent)
|
|
{
|
|
this->setParent(m_parent);
|
|
this->setGeometry(m_parent->geometry());
|
|
}
|
|
this->move(0,0);
|
|
this->show();
|
|
this->resize(m_parent->size());
|
|
update();
|
|
}
|
|
}
|
|
|
|
|
|
void ToolsWidget::resizeEvent(QResizeEvent *event)
|
|
{
|
|
update();
|
|
}
|
|
|
|
void ToolsWidget::closeEvent(QCloseEvent *event)
|
|
{
|
|
setFloat();
|
|
event->ignore();
|
|
}
|
|
|
|
void ToolsWidget::recieveData(int const &id,const QByteArray &data)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|