优化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 -44
View File
@@ -2,14 +2,11 @@
#include "ui_tools_Index4.h"
tools_Index4::tools_Index4(QWidget *parent) :
QWidget(parent),
ToolsWidget(parent),
ui(new Ui::tools_Index4)
{
ui->setupUi(this);
m_parent = parent;
//检测文件夹,如果不存在,那么就新建一个,这里存着所有的qml文件
QDir *Dir = new QDir;
if(!Dir->exists("./Init"))
@@ -73,46 +70,6 @@ tools_Index4::~tools_Index4()
void tools_Index4::closeEvent(QCloseEvent *event)
{
setFloat();
event->ignore();
}
void tools_Index4::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 tools_Index4::setFloat(void)
{
if(this->parent())
{
this->setParent(nullptr);
this->move(50,50);
this->resize(800,480);
this->show();
}
else
{
this->setParent(m_parent);
this->setGeometry(m_parent->geometry());
this->move(0,0);
this->show();
update();
}
}
void tools_Index4::mouseReleaseEvent(QMouseEvent *event)
{