[SOLVED]QSystemTrayIcon



  • Hi all, in the my MainWindow's constructor (class derived by QMainWindow)I wrote this code to try to have a QSystemTrayIcon:
    @ QMenu *trayIconMenu;
    QAction *minimizeAction;
    QAction *restoreAction;
    QAction *quitAction;
    minimizeAction = new QAction("Minimizza", this);
    restoreAction = new QAction("Ripristina", this);
    quitAction = new QAction("Esci", this);

    connect (minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
    connect (restoreAction, SIGNAL(triggered()),this,SLOT(showNormal()));
    connect (quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    trayIconMenu = new QMenu(this);
    trayIconMenu->addAction (minimizeAction);
    trayIconMenu->addAction (restoreAction);
    trayIconMenu->addAction (quitAction);
    QSystemTrayIcon* systray = new QSystemTrayIcon(this);
    QIcon icon("/usr/share/icons/gnome/48x48/devices/phone.png");
    systray->setIcon(icon);
    systray->setContextMenu (trayIconMenu);@
    

    code compile but when running I don't get any error or any systrayicon. Why?

    Solved: I lost/forgetted systray->show() Oo


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.