Skip to content
Snippets Groups Projects
Commit 2d4ac408 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

UI: fix app opening from macOS dock

A single click on the app icon on macOS dock should
open the app.

Change-Id: Ied215ee9288d6d46fd8852a7daa996db7ac0468f
parent 12277751
No related branches found
No related tags found
No related merge requests found
......@@ -150,6 +150,9 @@ ApplicationWindow {
// layoutManager to handle as much as possible.
layoutManager.restoreWindowSettings()
}
if (Qt.platform.os.toString() === "osx") {
MainApplication.setEventFilter()
}
// This will trigger `visible = true`.
windowSettingsLoaded = true
......
......@@ -445,3 +445,11 @@ MainApplication::cleanup()
#endif
QApplication::exit(0);
}
#ifdef Q_OS_MACOS
void
MainApplication::setEventFilter()
{
installEventFilter(this);
}
#endif
......@@ -83,6 +83,18 @@ public:
return runOptions_[opt];
};
#ifdef Q_OS_MACOS
Q_INVOKABLE void setEventFilter();
bool eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::ApplicationActivate) {
restoreApp();
}
return QApplication::eventFilter(object, event);
}
#endif // Q_OS_MACOS
Q_SIGNALS:
void closeRequested();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment