So I drew a circle with QPainter.
My Question is: who can I save that circle in a variable so I can work with it ? I want to make an animation with the circle.
QPainter painter(this);
painter.setPen(dottedPen);
painter.drawEllipse(QRect(160,260,80,80));
You can implement your own class for Ellipse with all property you need. And then set
QPropertyAnimation
for any of your property. Here is a small example. Ellipse class (with 4 custom properties):And now create an instance of ellipse inside your widget. And reimplement
paintEvent
your widgetTo make ellipse visible now just set
visible=true
Also now you are avaliable to set any animation for custom properties. Here is example for
center
property