7int main(
int argv,
char *args[])
9 QApplication app(argv, args);
12 QGraphicsItem *ball =
new QGraphicsEllipseItem(0, 0, 20, 20);
14 QTimeLine *timer =
new QTimeLine(5000);
15 timer->setFrameRange(0, 100);
17 QGraphicsItemAnimation *animation =
new QGraphicsItemAnimation;
18 animation->setItem(ball);
19 animation->setTimeLine(timer);
21 for (
int i = 0; i < 200; ++i)
22 animation->setPosAt(i / 200.0, QPointF(i, i));
24 QGraphicsScene *scene =
new QGraphicsScene;
25 scene->setSceneRect(0, 0, 250, 250);
28 QGraphicsView *view =
new QGraphicsView(scene);