1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(widget): do not block logout on Linux desktop environments v2

Revert commit 191fc15b9f to use closeEvent()
but without QEvent::ignore() which blocked logout on various Linux desktops,
and without redundant hide(). Previous fix with hideEvent() produced
regressions because hide() is used in various places, which produced closing
behavior.

Since qApp->setQuitOnLastWindowClosed(false) is used, and
Qt::WA_DeleteOnClose is *NOT* used, default closeEvent() handling is enough
for implementing close-to-systray feature.

Improves fix for #1485 and closes #3699
This commit is contained in:
Vincas Dargis 2016-09-10 16:16:18 +03:00
parent 7a98ea337b
commit 6b00779dde
2 changed files with 4 additions and 4 deletions

View File

@ -568,11 +568,11 @@ void Widget::moveEvent(QMoveEvent *event)
QWidget::moveEvent(event);
}
void Widget::hideEvent(QHideEvent *event)
void Widget::closeEvent(QCloseEvent *event)
{
if (Settings::getInstance().getShowSystemTray() && Settings::getInstance().getCloseToTray())
{
QWidget::hideEvent(event);
QWidget::closeEvent(event);
}
else
{
@ -583,7 +583,7 @@ void Widget::hideEvent(QHideEvent *event)
}
saveWindowGeometry();
saveSplitterGeometry();
QWidget::hideEvent(event);
QWidget::closeEvent(event);
qApp->quit();
}
}

View File

@ -161,7 +161,7 @@ signals:
protected:
virtual bool eventFilter(QObject *obj, QEvent *event) final override;
virtual bool event(QEvent * e) final override;
virtual void hideEvent(QHideEvent *event) final override;
virtual void closeEvent(QCloseEvent *event) final override;
virtual void changeEvent(QEvent *event) final override;
virtual void resizeEvent(QResizeEvent *event) final override;
virtual void moveEvent(QMoveEvent *event) final override;