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. [Solved] setToolTip(QString()) leaves previous tooltip visible
Forum Updated to NodeBB v4.3 + New Features

[Solved] setToolTip(QString()) leaves previous tooltip visible

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.5k 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
    Asperamanca
    wrote on last edited by
    #1

    I have a widget where the tooltip dynamically changes, depending on the mouse cursor position. Within the mouseMoveEvent, I check whether the cursor is in one of several pre-defined areas, and set the tooltip accordingly.

    This part works just fine.

    However, in some cases I do not want to show any tooltip at all. In this case, I call

    @setToolTip(QString());@

    When I move the mouse cursor from an area with tooltip to one without, the last tooltip remains, although I no longer have any tooltip defined.

    Why does calling setToolTip without any string not hide the tooltip? Is there any way I can manually hide the tooltip?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Forgive
      wrote on last edited by
      #2

      Could you show us the part of your code that does the tooltip appear?

      You could do this?

      @if(myCursor.selectedText() == "Hello!") {
      QToolTip::showText([...]);
      } else {
      QTooltip::hideText();
      }@

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

        I do not use QTooltip. I simply subclassed from QLabel, and use setTooltip to change the text that should be displayed.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Asperamanca
          wrote on last edited by
          #4

          Sorry, I misunderstood your posting at first.

          Manually calling QTooltip::hideText() does what I need.

          Thanks!

          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