the trayicon of my app on linux it's not working.



  • Hello,

    In my app I create a trayicon and display a menu in it. This works perfectly on Windows but when I try it on Linux it doesn't work.
    in my desktop (Linux Ubuntu 14.04) the trayicon appears on the right side of the bar, perfectly, but when I double click it doesn't do anything and it's not showing the menu either, hoe ever when I try it in my laptop also with ubuntu14.04 the trayicon appears on the left side of the bar but it does show the menu and responds when I double click it.

    this it's my code for the trayicon

    if (QSystemTrayIcon::isSystemTrayAvailable())
    {
      trayIcon = new QSystemTrayIcon(this);
      trayIcon->setIcon(QIcon(":/images/Imagenes/iconosPERFQ-23.png"));
      trayIcon->setToolTip(tr("PerfQ Client"));
      trayIcon->setVisible(true);
      logoutAction = new QAction(tr("&Logout"), this);
      trayIconMenu = new QMenu(this);
      trayIconMenu->addAction(logoutAction);
      trayIcon->setContextMenu(trayIconMenu);
      connect (logoutAction,SIGNAL(triggered()), this, SLOT(logout()));
      connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                     this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
    }
    

    and this it's the slot

    void Client::iconActivated(QSystemTrayIcon::ActivationReason reason)
    {
      switch (reason)
      {
        case QSystemTrayIcon::DoubleClick:
          QMessageBox::information(this,"Double Click", "Double click has been press on trayicon");
          break;
        default:
          ;
      }
    }
    

    and this code it's working perfectly in Windows, it's there another way to do this on the UNIX OS


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you using your distribution Qt or did you install in using the package from Qt's web site ? If the later, please try again using Ubuntu's Qt



  • Hi,

    thanks.

    I'm using qt creator to develop my app. I have no idea how to use Ubuntu's Qt, could you help out a little. I didn't even know this was an option.


Log in to reply
 

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