Best way to animate a circle moving around the screen in Qt?

If I wanted to use Qt, just a few circles moved in a white rectangle or graph, what would be the best way?

Do I need to draw a white / graphic object where a circle moved each time? Is there an easy way to accomplish this in Qt?

+3
source share
2 answers
  • Create a QGraphicsView object for your widget and add a QGraphicsScene to view.
  • Add QGraphicsEllipseItem object for the scene
  • Use QPropertyAnimation to change the pos property of an ellipse element.

If you need more advanced features, you can create your own animation class in QPropertyAnimation.

enjoy :)

: Qt Next Generation UI .

+4

QWidget. timerEvent(), , update() , . paintEvent() - , QPainter. Qt Assistant QPainter.

Qt , - , .

0

Source: https://habr.com/ru/post/1735857/


All Articles