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

Change closeEvent() to hideEvent() for handling main window closing.
Close event is no longer ignored, which prevented logging out from
various Linux desktop environments.

Closes #1485
This commit is contained in:
Vincas Dargis 2016-09-04 16:37:58 +03:00
parent e92ce42908
commit 7ee883bcc7
2 changed files with 4 additions and 5 deletions

View File

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

View File

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