Make smart hide more perfect
This commit is contained in:
parent
f0c473507a
commit
0dbc91c371
1 changed files with 11 additions and 10 deletions
|
@ -47,6 +47,8 @@ MainWindow::MainWindow(QQuickView *parent)
|
||||||
{
|
{
|
||||||
new DockAdaptor(this);
|
new DockAdaptor(this);
|
||||||
|
|
||||||
|
installEventFilter(this);
|
||||||
|
|
||||||
setDefaultAlphaBuffer(false);
|
setDefaultAlphaBuffer(false);
|
||||||
setColor(Qt::transparent);
|
setColor(Qt::transparent);
|
||||||
|
|
||||||
|
@ -256,8 +258,6 @@ void MainWindow::clearViewStruts()
|
||||||
void MainWindow::createFakeWindow()
|
void MainWindow::createFakeWindow()
|
||||||
{
|
{
|
||||||
if (!m_fakeWindow) {
|
if (!m_fakeWindow) {
|
||||||
installEventFilter(this);
|
|
||||||
|
|
||||||
m_fakeWindow = new FakeWindow;
|
m_fakeWindow = new FakeWindow;
|
||||||
m_fakeWindow->setScreen(screen());
|
m_fakeWindow->setScreen(screen());
|
||||||
m_fakeWindow->updateGeometry();
|
m_fakeWindow->updateGeometry();
|
||||||
|
@ -292,7 +292,7 @@ void MainWindow::createFakeWindow()
|
||||||
void MainWindow::deleteFakeWindow()
|
void MainWindow::deleteFakeWindow()
|
||||||
{
|
{
|
||||||
if (m_fakeWindow) {
|
if (m_fakeWindow) {
|
||||||
removeEventFilter(this);
|
// removeEventFilter(this);
|
||||||
disconnect(m_fakeWindow);
|
disconnect(m_fakeWindow);
|
||||||
m_fakeWindow->deleteLater();
|
m_fakeWindow->deleteLater();
|
||||||
m_fakeWindow = nullptr;
|
m_fakeWindow = nullptr;
|
||||||
|
@ -373,9 +373,6 @@ void MainWindow::onVisibilityChanged()
|
||||||
clearViewStruts();
|
clearViewStruts();
|
||||||
setGeometry(windowRect());
|
setGeometry(windowRect());
|
||||||
|
|
||||||
if (!m_fakeWindow && !m_activity->existsWindowMaximized())
|
|
||||||
m_hideBlocked = false;
|
|
||||||
|
|
||||||
if (m_activity->existsWindowMaximized() && !m_hideBlocked) {
|
if (m_activity->existsWindowMaximized() && !m_hideBlocked) {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -412,20 +409,24 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::Enter:
|
case QEvent::Enter:
|
||||||
m_hideTimer->stop();
|
if (m_fakeWindow)
|
||||||
|
m_hideTimer->stop();
|
||||||
m_hideBlocked = true;
|
m_hideBlocked = true;
|
||||||
break;
|
break;
|
||||||
case QEvent::Leave:
|
case QEvent::Leave:
|
||||||
m_hideTimer->start();
|
if (m_fakeWindow)
|
||||||
|
m_hideTimer->start();
|
||||||
m_hideBlocked = false;
|
m_hideBlocked = false;
|
||||||
break;
|
break;
|
||||||
case QEvent::DragEnter:
|
case QEvent::DragEnter:
|
||||||
case QEvent::DragMove:
|
case QEvent::DragMove:
|
||||||
m_hideTimer->stop();
|
if (m_fakeWindow)
|
||||||
|
m_hideTimer->stop();
|
||||||
break;
|
break;
|
||||||
case QEvent::DragLeave:
|
case QEvent::DragLeave:
|
||||||
case QEvent::Drop:
|
case QEvent::Drop:
|
||||||
m_hideTimer->stop();
|
if (m_fakeWindow)
|
||||||
|
m_hideTimer->stop();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue