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. QSystemTrayIcon activated signal only sends on double click (Ubuntu/Gnome)
Qt 6.11 is out! See what's new in the release blog

QSystemTrayIcon activated signal only sends on double click (Ubuntu/Gnome)

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.5k Views
  • 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
    anshah
    wrote on last edited by
    #1

    I am using Ubuntu 18.04 with Gnome desktop and seeing the the activated signal only emits when double-clicking on the icon. I need to have emit on single click:

    connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this,        SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
    
    // Slot to handle tray icon activated signal
    void MyClass::onActivated(QSystemTrayIcon::ActivationReason r)
    {
        if (r == QSystemTrayIcon::Trigger)
        {
            if (!this->isVisible())
            {
                this->show();
            }
            else
            {
                this->hide();
            }
        }
    }
    

    I want to be able to either:

    • emit activated signal on single mouse click

    • detect a single mouse click event on the system tray icon

    jsulmJ 1 Reply Last reply
    0
    • A anshah

      I am using Ubuntu 18.04 with Gnome desktop and seeing the the activated signal only emits when double-clicking on the icon. I need to have emit on single click:

      connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
              this,        SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
      
      // Slot to handle tray icon activated signal
      void MyClass::onActivated(QSystemTrayIcon::ActivationReason r)
      {
          if (r == QSystemTrayIcon::Trigger)
          {
              if (!this->isVisible())
              {
                  this->show();
              }
              else
              {
                  this->hide();
              }
          }
      }
      

      I want to be able to either:

      • emit activated signal on single mouse click

      • detect a single mouse click event on the system tray icon

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @anshah I don't use Gnome, but is it possible that this is default behaviour?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • jsulmJ jsulm

        @anshah I don't use Gnome, but is it possible that this is default behaviour?

        A Offline
        A Offline
        anshah
        wrote on last edited by
        #3

        @jsulm It seems like this is default behavior for Gnome. However, on Unity desktop it only needs a single click.

        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