Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-53021

QDBusTrayIcon does not support 2 QSystemTrayIcon

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.5.0, 5.8
    • QPA: X11/XCB
    • None
    • Unix
    • f199bb9133fe0446c3afbecf0470a20b3f3e3d74

    Description

      When the QDBusTrayIcon (default platform theme, not the KDE one) is active, you can only have on QSystemTrayIcon.

      This code does not show any QSystemTrayIcon:

      #include <QtWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QImage img(64,64, QImage::Format_ARGB32);
          img.fill(Qt::red);
          QSystemTrayIcon sti(QIcon(QPixmap::fromImage(img)));
          sti.show();
      
          img.fill(Qt::blue);
          QSystemTrayIcon sti2(QIcon(QPixmap::fromImage(img)));
          sti2.show();
      
          return a.exec();
      }
      

      Warning message:

      ```
      QDBusMenuConnection::registerTrayIcon: failed to register "org.kde.StatusNotifierItem-20332-2" "/StatusNotifierItem
      ```

      The reason is simple: connection().registerObject(StatusNotifierItemPath, item); tries to register twice the same path! and when this fails, it is unregistered from QDBusMenuConnection::unregisterTrayIcon which unregister the peviously registered QSystemTrayIcon

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            ogoffart Olivier Goffart (Woboq GmbH)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes