Originally Posted by
wysota
First of all it is not a hack and second of all you are obviously doing something wrong, the timer can't possibly trigger again before the previous iteration ends. I think you are getting some effect that incorrectly suggests that this is the case. For instance if you call update() from the timer's timeout slot, then it is true that timeout() might be called again before paintEvent() is executed (although it's unlikely). This is due to the fact that update() only schedules an event and doesn't do any repainting. However I agree with Santosh that you shouldn't need such calls at all. You need to update the canvas if it changes, there is no point in redrawing it with the same contents as before, it's just a waste of CPU cycles.