Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSystemTrayIcon minimized issues on Ubuntu



  • I have a Qt GUI application with a QMainWindow that displays and minimizes when clicking on the QSystemTrayIcon on the top status bar. When the QMainWindow is minimized there is a dashboard icon that is available on the Ubuntu dashboard which is located on the left side of the screen by default.

    The main issue is that once the QMainWindow is minimized to the dashboard the only way to get it to display again is to click on the dashboard icon, which is fine, but the QSystemTrayIcon becomes unresponsive when the QMainWindow is minimized. I want to be able to click on the dashboard icon or system tray icon to get the UI back.

    I've tried everything including trying to capture mouse click events but the challenge is the QSystemTrayIcon is derived from a QObject not a QWidget so it cannot capture mouse click events.

    Any help would be most appreciated?


  • Lifetime Qt Champion

    Hi,

    Isn't the activated signal what you are looking for ?



  • @SGaist The activated signal does not trigger when the QMainWindow is minimized. That is why I was looking for a workaround using QMouseEvents. Since QSystemTrayIcon is a QObject it can't handle mouse events.


  • Lifetime Qt Champion

    Does this happen with your distribution provided Qt or with a custom installation ?

    AFAIK, activated should not be dependent on the state of your main window.


Log in to reply