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. the trayicon of my app on linux it's not working.
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 756 Views 2 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
    ACJH48
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ACJH48
        wrote on last edited by ACJH48
        #3

        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.

        1 Reply Last reply
        0

        • Login

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