Hi,

I am designing an application that open instances of a QMainWindow subclass when I double-clicked on a system tray icon.

I've choosen to instanciate my QSystemTrayIcon subclass as the main widget in main.cpp so there is no parent widget for the QSystemTrayIcon and for QMainWindow subclasses as well as I can't set a QObject as a parent of a QMainWindow.

The problem is I have a QAction in my QSystemTrayIcon subclass that I would like to enable or disable regarding a connexion state that is set in a deeper child level widget in a QThread.

I have tried to define a static signal in the QThread subclass and connecting the QSystemTrayIcon directly to the class but it doesn't work and a search on the forum told me it is not possible as well.

Sure, I have an idea how I can do it by creating a static method in the QSystemTrayIcon to notify connection / disconnection.

But such a solution would make the QThread subclass specifically related to my application because I need to call QSystemTrayIcon::notifyConnection() in it.

I have no need to use this QThread subclass elsewhere but I don't like to have such an architectural flaw in my app.

Does someone skilled than me see an elegant solution to this problem ?

Or is setting a QSystemTrayIcon as the main widget of an application is simply a very bad idea ?