#include <QtGui>
int main (int argc, char *argv[])
{
QPixmap testimage
("/images/car.jpg");
timer->setFrameRange(0, 100);
timer->setLoopCount(1);
animation->setItem(item);
animation->setTimeLine(timer);
animation
->setPosAt
(0.0,
QPoint(-800,
100));
animation
->setPosAt
(0.10,
QPoint(-600,
100));
animation
->setPosAt
(0.15,
QPoint(-400,
100));
animation
->setPosAt
(0.20,
QPoint(-100,
100));
animation
->setPosAt
(0.25,
QPoint(-50,
100));
animation
->setPosAt
(0.50,
QPoint(600,
100));
scene->setSceneRect(0, 0, 250, 250);
scene->addItem(item);
view->resize(1024, 768);
view->show();
timer->start();
return a.exec();
}
#include <QtGui>
int main (int argc, char *argv[])
{
QApplication a(argc, argv);
QPixmap testimage("/images/car.jpg");
QGraphicsPixmapItem* item = new QGraphicsPixmapItem(testimage);
QTimeLine *timer = new QTimeLine(15000);
timer->setFrameRange(0, 100);
timer->setLoopCount(1);
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(item);
animation->setTimeLine(timer);
animation->setPosAt(0.0, QPoint(-800, 100));
animation->setPosAt(0.10, QPoint(-600, 100));
animation->setPosAt(0.15, QPoint(-400, 100));
animation->setPosAt(0.20, QPoint(-100, 100));
animation->setPosAt(0.25, QPoint(-50, 100));
animation->setPosAt(0.50, QPoint(600, 100));
QGraphicsScene *scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 250, 250);
scene->addItem(item);
QGraphicsView *view = new QGraphicsView(scene);
view->resize(1024, 768);
view->show();
timer->start();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks