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 tool tip not showing on mouse hover
Forum Updated to NodeBB v4.3 + New Features

QSystemTrayIcon tool tip not showing on mouse hover

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 2.0k 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
    anshah
    wrote on last edited by
    #1

    I have setup a QSystemTrayIcon with a tool tip but it doesn't show up on mouse hover. I'm running Qt 5.8 on Ubuntu 17.04

    Here is the setup code:

    QSystemTrayIcon *m_pTrayIcon  = new QSystemTrayIcon(this);
    QIcon icon(*m_pImage);
    m_pTrayIcon->setIcon(icon);
    m_pTrayIcon->show();
    m_pTrayIcon->setToolTip(tr("ToolTip Test));
    

    I do not see the tool tip show on mouse hover over the system tray icon. Do I need to capture a mouse hover event in order to have this shown?

    jsulmJ 1 Reply Last reply
    0
    • A anshah

      I have setup a QSystemTrayIcon with a tool tip but it doesn't show up on mouse hover. I'm running Qt 5.8 on Ubuntu 17.04

      Here is the setup code:

      QSystemTrayIcon *m_pTrayIcon  = new QSystemTrayIcon(this);
      QIcon icon(*m_pImage);
      m_pTrayIcon->setIcon(icon);
      m_pTrayIcon->show();
      m_pTrayIcon->setToolTip(tr("ToolTip Test));
      

      I do not see the tool tip show on mouse hover over the system tray icon. Do I need to capture a mouse hover event in order to have this shown?

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

      @anshah said in QSystemTrayIcon tool tip not showing on mouse hover:

      m_pTrayIcon

      m_ prefix is usually used for class members, but you're declaring a new local variable here:

      QSystemTrayIcon *m_pTrayIcon  = new QSystemTrayIcon(this);
      

      Where is this code executed? Do you have a class member called m_pTrayIcon? Did you make sure m_pImage is a valid image?

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

      1 Reply Last reply
      2
      • A Offline
        A Offline
        anshah
        wrote on last edited by anshah
        #3

        @jsulm
        So m_pTrayIcon is a class member I just added for the purposes of clarity so you could see the type. Yes, m_pImage is a valid image. Everything works fine...I am just not getting a tool tip to show.

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by hskoglund
          #4

          Hmm, I have a program that also uses QSystemTrayIcon, and the tool tip text is shown both on my Windows 7 and my Windows 10 PCs, here's the code:

          trayIconMenu = new QMenu(this);
          trayIconMenu->addAction(quitAction);
          
          pTrayIcon = new QSystemTrayIcon(this);
          pTrayIcon->setIcon(QIcon(":/Images/TrayIcon.ico"));
          pTrayIcon->setVisible(true);
          pTrayIcon->showMessage("balloon title","balloon message");
          pTrayIcon->setToolTip("this is the tooltip");
          pTrayIcon->setContextMenu(trayIconMenu);
          pTrayIcon->show();
          

          Edit: sorrry didn't see until now that your'e not on Windows. I tried the above code on my Ubuntu 18.04 with Qt 5.13.0, while everything works the same as on Windows PCs except there's no tooltip text visible :-(

          Maybe some design limit in Ubuntu's desktop...

          A 1 Reply Last reply
          0
          • hskoglundH hskoglund

            Hmm, I have a program that also uses QSystemTrayIcon, and the tool tip text is shown both on my Windows 7 and my Windows 10 PCs, here's the code:

            trayIconMenu = new QMenu(this);
            trayIconMenu->addAction(quitAction);
            
            pTrayIcon = new QSystemTrayIcon(this);
            pTrayIcon->setIcon(QIcon(":/Images/TrayIcon.ico"));
            pTrayIcon->setVisible(true);
            pTrayIcon->showMessage("balloon title","balloon message");
            pTrayIcon->setToolTip("this is the tooltip");
            pTrayIcon->setContextMenu(trayIconMenu);
            pTrayIcon->show();
            

            Edit: sorrry didn't see until now that your'e not on Windows. I tried the above code on my Ubuntu 18.04 with Qt 5.13.0, while everything works the same as on Windows PCs except there's no tooltip text visible :-(

            Maybe some design limit in Ubuntu's desktop...

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

            @hskoglund
            Thanks for the reply! Looks like your using everything latest and greatest. I'm using Qt 5.8 on Ubuntu 17.04.
            Maybe this is a design limitation on Ubuntu. If any of you "QT Champions" can confirm this that would be great!

            Also, same deal on CentOS, RHEL, Fedora?

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

              Hi,

              Are you using the Qt version that comes with your distribution ?

              From what I remember, the Ubuntu guys used to patch Qt to integrate with their desktop shell.

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

              A 1 Reply Last reply
              1
              • SGaistS SGaist

                Hi,

                Are you using the Qt version that comes with your distribution ?

                From what I remember, the Ubuntu guys used to patch Qt to integrate with their desktop shell.

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

                @sgaist I'm using a Qt 5.8 manual install.

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

                  Then, please try the version provided by the distribution just to check if it behaves as expected.

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

                  A A 2 Replies Last reply
                  0
                  • SGaistS SGaist

                    Then, please try the version provided by the distribution just to check if it behaves as expected.

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

                    @SGaist Sorry for the long delay in response as I got pulled off to other issues now I'm back on this one. So to answer your question I tried again with the Qt Version that comes with my Ubuntu distribution and the tooltip still does not pop up.

                    I'm am using Ubuntu 18.04 with Gnome Desktop (3.28.2) .

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Then, please try the version provided by the distribution just to check if it behaves as expected.

                      A Offline
                      A Offline
                      Alina9000
                      wrote on last edited by
                      #10

                      @SGaist, I faced the same problem on Ubuntu 20.04. I have Qt5 and Qt6 installed, in both versions toolTips are not displayed. However, in Windows 10 everything works without problems.

                      Windows 10:
                      6daaa603-70e4-4ac0-92b7-8b9deec752a6-image.png

                      Ubuntu 20.04
                      3506a1e5-a533-4a03-b1a3-66be4af4ed10-image.png

                      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