Explicitly hide tray icon before exit on Windows

Currently flameshot tray icon will not disappear after program
terminates on Windows. This is a known issue and need to be
explicitly handled.

This commit connects the aboutToQuit signal to
QSystemTrayIcon::hide slot to ensure that the tray icon is
removed before program terminates.
This commit is contained in:
Boyuan Yang
2020-09-25 22:03:35 -04:00
committed by borgmanJeremy
parent 2bc3d82666
commit 40629915f7

View File

@@ -234,6 +234,13 @@ void Controller::enableTrayIcon()
}
};
connect(m_trayIcon, &QSystemTrayIcon::activated, this, trayIconActivated);
#ifdef Q_OS_WIN
// Ensure proper removal of tray icon when program quits on Windows.
connect(
qApp, &QCoreApplication::aboutToQuit, m_trayIcon, &QSystemTrayIcon::hide);
#endif
m_trayIcon->show();
}