Unsolved QSystemTrayIcon does not seem.
-
Hi; I am using QSystemTrayIcon but icon does not seem. My code:
QSystemTrayIcon* tray_icon = new QSystemTrayIcon; tray_icon->setToolTip("Hello World!"); tray_icon->showMessage(tr("Message Title"), tr("Hello Everbody!"), QSystemTrayIcon::Critical); tray_icon->setVisible(true);
Thanks.
-
@Ibrahim said:
first thing to do:
"check whether a system tray is present on the user's desktop, call the QSystemTrayIcon::isSystemTrayAvailable() static function."if check did not fail mostly likely button is there you just see no icon cause you did not set any.
#include <QSystemTrayIcon>
#include <QIcon>
#include <QDebug>
#include <QApplication>............
QSystemTrayIcon* tray_icon = new QSystemTrayIcon (this );
tray_icon->setToolTip("Hello World!");QIcon icon = QApplication::style()->standardIcon( QStyle::SP_ComputerIcon ) ; Q_ASSERT( !icon.isNull() ); tray_icon->setIcon( icon ); tray_icon->show(); tray_icon->showMessage(tr("Message Title"), tr("Hello Everbody!"), QSystemTrayIcon::Critical );
-
@alex_malyu thanks. Can I use that in mobile applications (like notification)?
-
@alex_malyu said:
QSystemTrayIcon::isSystemTrayAvailable()
I have no experience, I think if QSystemTrayIcon::isSystemTrayAvailable() returns there true you can, otherwise you can't.