I'm learning about QPainter, and I've created a simple widget where each time the user clicks on the widget, a new circle appears at that point.
But Qt doesn't allow painting outside paintEvent, so each time I want to draw a new circle, I need to invalidate the widget area and redraw all the previous circles, too. That doesn't seem very efficient - what if there are hundreds or even thousands of elements.
It would be best if the previous circles weren't erased, and I just drew the new one on top of the widget. But on Qt I can't draw without first invalidating (and thus erasing) the previous content.
What is the recommended way of handling this situation in Qt?