Skip to content
Advertisement

QPainter Save State

I have a QWidget in which I use a QPainter object to draw some dots but when update() method is invoked, the QWidget’s draw is cleared completely. Is there any way to save the actual state and just add dots, or i have to save every dot and paint them in every paintEvent() call ? Basically when I press an arrow, I must show a line on the QWidget (it’s for a car rally).

Advertisement

Answer

I solved my problem using QPainterPath so that I can group ellipses to draw ‘dynamic’ lines:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement