Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Sytem tray icon not available for QtQuick2 apps?

    QML and Qt Quick
    3
    3
    1352
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      ivoryz last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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).

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • I
          Itehnological last edited by

          That works, except that it creates an additional window with the tray icon.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post