I can’t affirm the repaint was the only one responsible of problem, but doing an update() instead of repaint() solve the problem.
For what I saw (I tried to put some traces in paintEvent()) after 255 call to setForeGround():
- With update(), the paintEvent() is called once at the end
- With repaint(), the paintEvent() is called:
– 255 times when mainwindow is 3840x2094 pixels size
– 15 times when mainwindow is 454x352 pixels size
I’m not good enough to understand Qt underlying process, but even with 255 paintEvent(), I think it shouldn’t be so long but…