界面停靠

This commit is contained in:
hm
2020-08-24 22:59:05 +08:00
parent 580a311af3
commit 3c24fdce2e
5 changed files with 46 additions and 26 deletions
+23 -14
View File
@@ -17,14 +17,9 @@ tools_Index4::tools_Index4(QWidget *parent) :
this->setStyleSheet(stylesheet);
file.close();
setWindowTitle(tr("Servos Inspector"));
//this->setFloating(true);
//this->setWindowFlags(Qt::Tool);
//setWindowFlags(Qt::Dialog);
}
tools_Index4::~tools_Index4()
@@ -32,23 +27,37 @@ tools_Index4::~tools_Index4()
delete ui;
}
void tools_Index4::closeEvent(QCloseEvent *event)
{
qDebug() << event;
}
void tools_Index4::mouseMoveEvent(QMouseEvent *event)
{
Q_UNUSED(event)
this->setParent(nullptr);
this->setGeometry(m_parent->geometry());
this->show();
if(this->parent())
{
this->setParent(nullptr);
this->setWindowFlags(Qt::Dialog);
this->move(0,10);
this->show();
}
qDebug() << "Move" << event;
}
void tools_Index4::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_UNUSED(event)
//this->setParent(m_parent);
this->setParent(m_parent);
setWindowFlags(Qt::Widget);
this->setGeometry(m_parent->geometry());
this->move(0,10);
this->show();
//this->setGeometry(m_parent->geometry());
qDebug() << "DoubleClick" << event;
//this->show();
}
+3
View File
@@ -6,6 +6,7 @@
#include "QFile"
#include "QTextStream"
#include "QDebug"
#include "QCloseEvent"
namespace Ui {
class tools_Index4;
@@ -28,6 +29,8 @@ public slots:
protected:
void closeEvent(QCloseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);