Results 1 to 2 of 2

Thread: Do variables in QToolTip update automatically

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Do variables in QToolTip update automatically

    Seems to me that the tooltip text is created when it is initialized from the values the variables have -at that time-. If you want the tooltip to change as the variables change, you will have to re-format the text each time the variables change. Basically, your format statement creates a QString, and this QString is passed in as the tooltip text. The tooltip itself knows nothing about the variables used to create the string.

    The behavior you are seeing seems pretty reasonable to me - what if you -didn't- want the tooltip to change with the variables? If it was automatically updated each time, there would be no way to prevent that.

    In QMessageBox, I assume you are passing the text every time you post it (using one of the static methods - warning(), information() whatever). If you created a QMessageBox, set the text, and then just called show() and hide(), I'll bet you won't see updated text, just the text as it was when created.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  2. The following user says thank you to d_stranz for this useful post:

    dennisvz (23rd July 2020)

Similar Threads

  1. Update a QGraphicsScene every x seconds automatically
    By Nezgal in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2013, 07:55
  2. Using CSS with Static QTooltip?
    By droneone in forum Qt Programming
    Replies: 0
    Last Post: 26th December 2012, 16:18
  3. Replies: 0
    Last Post: 12th July 2011, 08:19
  4. Replies: 5
    Last Post: 30th January 2010, 10:09
  5. QToolTip
    By suresh in forum Newbie
    Replies: 7
    Last Post: 6th September 2006, 15:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.