Results 1 to 4 of 4

Thread: immediate update of QT object

  1. #1
    Join Date
    Feb 2007
    Posts
    48
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default immediate update of QT object

    I have some code that updates the color portion of a radiobutton and a few lines later updates the text. I put calls to update and repaint (e.g rb->repaint) after each object update. the color updates but is takes a while for the text to update.

    How to I perform an immediate refresh on my object ao that there isn't a delay in the display.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: immediate update of QT object

    I am not sure without seeing any code.
    Does something happens in those few intermediary lines of code?

    Call rb->update() only once, after setting the text color. Do them both in one step.
    Calling repaint causes an update to be immediately executed, so there might have been a problem calling it twice.
    Do it with update. It will schedule a paintEvent.

    Regards

  3. The following user says thank you to marcel for this useful post:

    db (14th August 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    48
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: immediate update of QT object

    I figured out what the problem was. I had to follow the radiobutton->repaint() with a widget repaint(). The button was in a frame on the widget. I guess I had to force the top level object to repaint to get the update before the next update event.

    Thanks again

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: immediate update of QT object

    You shouldn't need to do it. You must have something wrong in your code. And use update() instead of repaint(). It might be that you're blocking the event loop.

Similar Threads

  1. why there is no update on maximize? [QTableWidget]
    By macias in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 15:01
  2. How to update statusbar and tooltips
    By aamer4yu in forum Qt Programming
    Replies: 9
    Last Post: 21st December 2006, 12:38
  3. Replies: 9
    Last Post: 7th November 2006, 15:10
  4. QSlider Update Problem
    By December in forum Qt Programming
    Replies: 4
    Last Post: 10th September 2006, 04:02
  5. Using QSA: A very basic question
    By yogeshm02 in forum Newbie
    Replies: 3
    Last Post: 26th January 2006, 07:34

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.