Reputation: 339
I want to dynamically set the text instead of Icon in QSystemTrayIcon
. How it is possible ?
Upvotes: 6
Views: 1334
Reputation: 12854
Tray icon is not designed to show text, just small image. Also, you can set tooltip message as @Merlin069 said, show balloon message or create context menu.
Of cource, you can create an image in you program and draw some text on it:
QPixmap pixmap(24,24);
pixmap.fill(Qt::white);
QPainter painter(&pixmap);
painter.drawText(pixmap.rect(),Qt::AlignCenter,"Hi!");
icon.setIcon(pixmap);
icon.setToolTip("Hi!");
icon.setVisible(true);
Upvotes: 11