I am having trouble with the busy indicator. I have an object (qobject) that lives on the main thread, this object has a QTimer. Each 40ms, the timer triggers a function, this function prepares an image, than, do a window()->update() to trigger a repaint of the window. The window calls my openGL function when the beforeRendering signal is emitted. So far so good, I am able to have a new image every 40ms or so. The window is ONLY refreshed every 40 ms. I did not connect anything to trigger vsync updates or things like that.

Things got a little more complicated when I tried to implement a buffering mechanism. Basically, if my function that prepares an image is heavy, like a couple of seconds or so, I want to show the busyIndicator (spinner) and let the GUI thread continue. I start another thread to compute my image and asynchronously wait for a result. When the result is here, I stop the busyIndicator and display my new image.

The thing is that now, my timer is not triggered every 40ms anymore. It is triggered at 30/50 ms. Also, my draw function (connected to beforeRendering) is triggered at every vsync. That was not the case previously.

I made a test app to check if I can observe the same behaviour on a smaller scale. I observed that when the busyIndicator runs, the timers are imprecise (okay not a big deal). However, when I turn the busyIndicator off in my test app, the timer running at 40ms comes back to a working state. I also noticed that the busy indicator runs at 60fps (vsync) or 144fps on my 144hz monitor.

The busy indicator seems to be the problem because if I remove it from my main app, the timer is always on time.

Has anyone ever encountered this behaviour? Is there an easy way to debug those types of bugs?

Thanks a lot,