PDA

View Full Version : immediate update of QT object



db
13th August 2007, 18:53
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.

marcel
13th August 2007, 22:27
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

db
14th August 2007, 11:55
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

wysota
14th August 2007, 12:25
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.