Update UI from background thread freezes the app
-
I wonder whats the best way to update a progress bar on my QMainWindow implementation that reacts on QEvents sent by a background thread. The background thread can emit those events pretty fast. What happens is that when the events come in fast, the progress bar is updated but the main window reacts sluggish when u use other widgets in it our drag it around.
I could throttle the updates using a timer probably, but is this the only way? -
Does every change actually modify the progress bar in a meaningful way? Or will many of those updates result in a progress bar that visually looks the same?
You could send out the update event only if the value change is significant enough to warrant it.
-
what if you put a delay in worker thread loop?