Qt tends to merge multiple paint events into one, but this might be not enough. IMO it's better to assume that you don't know when the paint even arrives and avoid changing the state in paintEvent().
Instead of a flag, you could use some variable that denotes the scroll amount. This way you don't have to care how many times and when paintEvent() was called.
Bookmarks