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. Update tooltip of QSystemTrayIcon when displayed
Forum Updated to NodeBB v4.3 + New Features

Update tooltip of QSystemTrayIcon when displayed

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 2.8k 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.
  • C Offline
    C Offline
    cOld
    wrote on last edited by
    #1

    Hi all,

    I'm using a QSystemTrayIcon widget in my app. I noticed that if the tooltip is already displayed then the text is not updated until I move out the mouse and move it again on the tray icon.
    Is there a way to update the content of a tooltip of the QSystemTrayIcon when it is already displayed?

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

      Hi and welcome to devnet,

      On which platform are you seeing that ? Which version of Qt are you using ?

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

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        On which platform are you seeing that ? Which version of Qt are you using ?

        C Offline
        C Offline
        cOld
        wrote on last edited by
        #3

        @SGaist
        Hi and thank you for the reply.
        Actually I'm working on a crossplatform desktop app on Windows and Mac with Qt 5.5.

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

          Are you seeing that behavior on both OSs ?

          Which version of the OSs are you using ?

          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
          • C Offline
            C Offline
            cOld
            wrote on last edited by
            #5

            Yes the behaviour is the same on both platform (OSX 10.11.3 and Windows 10 with the latest updates).

            As far as I understood, QSystemTrayIcon tooltip is not using QToolTip but it relies on the tooltip provided by the os which has some limitation.
            I'm not able to find a proper event/method to override in order intercept the tooltip handling and use a QToolTip.

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

              You can try to reimplement the event method and check there for the QToolTip event.

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

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                You can try to reimplement the event method and check there for the QToolTip event.

                C Offline
                C Offline
                cOld
                wrote on last edited by
                #7

                @SGaist

                That is what I tried but I didn't receive any event :(

                From the official documentation:
                "Only on X11, when a tooltip is requested, the QSystemTrayIcon receives a QHelpEvent of type QEvent::ToolTip. Additionally, the QSystemTrayIcon receives wheel events of type QEvent::Wheel. These are not supported on any other platform."

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

                  I missed that bit of the doc. Then, you're pretty much out of luck outside trying to modify Qt but that doesn't mean there's any support for that use case natively.

                  Out of curiosity, why do you need to do that ?

                  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
                  • C Offline
                    C Offline
                    cOld
                    wrote on last edited by
                    #9

                    I'm going to download/upload files so I would like to show the percentage and remaining time in the tooltip

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

                      The tooltip isn't necessarily the best tool to show such dynamic data. You should maybe have that information on a dialog that you open on a mouse click. And just show a rough estimate in the tooltip.

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

                      C 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        The tooltip isn't necessarily the best tool to show such dynamic data. You should maybe have that information on a dialog that you open on a mouse click. And just show a rough estimate in the tooltip.

                        C Offline
                        C Offline
                        cOld
                        wrote on last edited by
                        #11

                        @SGaist
                        I agreed with you, tooltips are not concerned for this kind of info but the product owner was not of the same idea :D

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

                          Take for example the DropBox client, it's on the widget associated to the system tray icon that you will find this kind of information.

                          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

                          • Login

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