Files
gcs-nf/App/ToolsUI/ToolsWidget.cpp

93 lines
1.5 KiB
C++

#include "ToolsWidget.h"
ToolsWidget::ToolsWidget(QWidget *parent) : QWidget(parent), ini_size(size() )
{
setWindowFlags(Qt::Widget);
}
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::setValue(QCheckBox *w,QString s)
{
w->setText(s);
update();
}
void ToolsWidget::setFloat(void)
{
Qt::WindowFlags flags = this->windowFlags();
if(flags != (Qt::Widget | Qt::Window ) )
{
QWidget *m_parent;
m_parent = qobject_cast<QWidget *>(this->parent());
if(m_parent)
{
is_pop = true;
this->setWindowFlags(Qt::Widget | Qt::Window );
resize(ini_size);
move(0, 0);
show();
}
}
}
void ToolsWidget::resizeEvent(QResizeEvent *event)
{
update();
}
void ToolsWidget::closeEvent(QCloseEvent *event)
{
QWidget *m_parent;
setWindowFlags(Qt::Widget);
move(0, 0);
m_parent = qobject_cast<QWidget *>(this->parent());
if(m_parent)
{
this->resize(m_parent->size() );
}
show();
is_pop = false;
emit toolsWidgetClose();
event->ignore();
}
void ToolsWidget::recieveData(int const &id,const QByteArray &data)
{
}