hi
the following code works .
but how does the for loop is executed after timer has started(after the for loop the timer is started)

Qt Code:
  1. #include <QtGui>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5. QApplication a(argc, argv);
  6. QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
  7.  
  8. QTimeLine *timer = new QTimeLine(5000);
  9. timer->setFrameRange(0, 100);
  10.  
  11. animation->setItem(ball);
  12. animation->setTimeLine(timer);
  13.  
  14. for (int i = 0; i < 200; ++i)
  15. animation->setPosAt(i / 200.0, QPointF(i, i));
  16.  
  17. scene->setSceneRect(0, 0, 250, 250);
  18. scene->addItem(ball);
  19.  
  20. QGraphicsView *view = new QGraphicsView(scene);
  21. view->show();
  22.  
  23. timer->start();
  24. return a.exec();
  25. }
To copy to clipboard, switch view to plain text mode