Improve tray icon behavior on OS X.

Previously the main window had issues on restore:
- was sometimes hidden again.
- window was unresponsive, all actions disabled.
This commit is contained in:
Felix Geyer 2015-09-27 23:16:18 +02:00
parent 4f2d56a55f
commit b8c1829857

View File

@ -20,6 +20,7 @@
#include <QCloseEvent> #include <QCloseEvent>
#include <QShortcut> #include <QShortcut>
#include <QTimer>
#include "autotype/AutoType.h" #include "autotype/AutoType.h"
#include "core/Config.h" #include "core/Config.h"
@ -448,7 +449,7 @@ void MainWindow::changeEvent(QEvent *event)
&& isTrayIconEnabled() && config()->get("GUI/MinimizeToTray").toBool()) && isTrayIconEnabled() && config()->get("GUI/MinimizeToTray").toBool())
{ {
event->ignore(); event->ignore();
hide(); QTimer::singleShot(0, this, SLOT(hide()));
} }
else { else {
QMainWindow::changeEvent(event); QMainWindow::changeEvent(event);
@ -578,6 +579,7 @@ void MainWindow::toggleWindow()
hide(); hide();
} }
else { else {
setWindowState(windowState() & ~Qt::WindowMinimized);
show(); show();
raise(); raise();
activateWindow(); activateWindow();