mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-21 15:24:01 +02:00
mainapplication: on tray icon click close window if open and focused
Only do so on non-Windows platforms, though; apparently this is not a common pattern for desktop applications on Windows. Change-Id: Ie1f8f4dd087d4e2798be4d102eb1d421fa9490f7
This commit is contained in:
parent
1284a8423c
commit
c8099b73da
1 changed files with 10 additions and 1 deletions
|
@ -492,8 +492,17 @@ MainApplication::initSystray()
|
||||||
connect(systemTray_.get(),
|
connect(systemTray_.get(),
|
||||||
&QSystemTrayIcon::activated,
|
&QSystemTrayIcon::activated,
|
||||||
[this](QSystemTrayIcon::ActivationReason reason) {
|
[this](QSystemTrayIcon::ActivationReason reason) {
|
||||||
if (reason != QSystemTrayIcon::ActivationReason::Context)
|
if (reason != QSystemTrayIcon::ActivationReason::Context) {
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
restoreApp();
|
restoreApp();
|
||||||
|
#else
|
||||||
|
QWindow* window = focusWindow();
|
||||||
|
if (window)
|
||||||
|
window->close();
|
||||||
|
else
|
||||||
|
restoreApp();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
systrayMenu->addAction(quitAction);
|
systrayMenu->addAction(quitAction);
|
||||||
|
|
Loading…
Add table
Reference in a new issue