Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]QSystemTrayIcon
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QSystemTrayIcon

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aleskandro
    wrote on 23 Mar 2012, 02:41 last edited by
    #1

    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

    1 Reply Last reply
    0

    1/1

    23 Mar 2012, 02:41

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved