Sytem tray icon not available for QtQuick2 apps?
-
AFAIK, QSystemTrayIcon comes from the QtWidgets module, and cannot be used directly in QtQuick2 apps which use QGuiApplication and QQuickView. My small test resulted in "QWidget: Cannot create a QWidget when no GUI is being used" during run-time when
@(QSystemTrayIcon*)trayIcon->show()@
is called (QSystemTrayIcon inherits QObject rather than QWidget, though) or when any QWidget descendant is instantiated, like:
@trayIconMenu = new QMenu()@
How to use system tray icons with QtQuick2 then? Is this feature under development in Qt5? Any workarounds, e.g. sending/receiving signals between a QtQuick2 and QApplication-based systray apps?
-
I think it's still being worked on, IIRC. Same goes for window icons, actually.
Try instantiating QApplication instead of QGuiApplication, maybe it will work this way (I haven't tried).
-
That works, except that it creates an additional window with the tray icon.