Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.5.0, 5.8
-
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