PDA

View Full Version : QT3 -- updating a GUI all at once, instead of widget by widget



Ronayn
1st August 2011, 14:47
I've a complex GUI with multiple widgets, include over 300 LED widgets. Periodically, I receive update information (for all the widgets).

How do I disable the updating of the GUI until I've done all my "setText" and "setLED" and "setWhatever" calls? Normally, each of these calls would trigger a GUI update -- thats a lot of unecessary updating that causes noticeable flicker.

wysota
1st August 2011, 18:49
If you do all those calls without returning to the event loop, all updates will be executed in one go. You can obtain such situation by using a timer and doing all the setText/setLED calls upon the timer's timeout.

Ronayn
1st August 2011, 19:06
Hmmm... I think I need to review how QT3 widgets work then. I thought that when you called setText, from within (slot) function, for a widget (like QLabel, for example), it immediately updated the widget (including visually). However, if I understand you correctly, the visual update doesn't happen until the event loop is returned to?

wysota
1st August 2011, 22:13
I thought that when you called setText, from within (slot) function, for a widget (like QLabel, for example), it immediately updated the widget (including visually).
No, it updates the data and schedules a paint event.

However, if I understand you correctly, the visual update doesn't happen until the event loop is returned to?
Correct. However all widgets will be painted separately. Just that it will happen during the same event processing iteration.