Details
-
Bug
-
Resolution: Done
-
P4: Low
-
6.3.0 Feature Freeze
-
None
-
46cadf7b48288fce4de6147ae38de493354c23d0 (qt/qtbase/dev) 84911c30d4546500d1ef6bf7e9251125b0fce3d4 (qt/qtbase/6.2)
Description
It shows the QMessageBox:
The program will keep running in the system tray. To terminate the program, choose Quit in the context menu of the system tray entry.
even though I'm doing what it says, to terminate by selecting Quit on the context menu.
Tested with xfce4-panel's version of the tray, which is a D-Bus system tray (which conveniently can run on a plain X11 session without a full desktop environment like KDE or Gnome).
And it turns out that in this case the QCloseEvent is not spontaneous, so we can easily avoid it with the same code that so far was needed only on macOS:
//! [2] void Window::closeEvent(QCloseEvent *event) { #ifdef Q_OS_MACOS if (!event->spontaneous() || !isVisible()) { return; } #endif if (trayIcon->isVisible()) { QMessageBox::information(this, tr("Systray"), tr("The program will keep running in the " "system tray. To terminate the program, " "choose <b>Quit</b> in the context menu " "of the system tray entry.")); hide(); event->ignore(); } } //! [2]
This needs testing on all the platforms to see if they're all consistent now, apparently.
Attachments
Issue Links
- relates to
-
QTBUG-103515 QSystemTrayIcon/macOS: Cannot quit the app when the context menu is opened by secondary click
-
- Closed
-