2012年10月23日 星期二

[cpp][qt4] New an QLabel with image and set the Animation

[cpp][qt4] New an QLabel with image and set the Animation


QLabel* imagelb = new QLabel();
QPixmap pmap(":/images/google.png");
imagelb->setPixmap(pmap);
imagelb->show();
my_scene->addWidget(imagelb);

QPropertyAnimation *mv = new QPropertyAnimation(imagelb, "pos");
mv->setDuration(2000);
mv->setStartValue(QPoint(x,y));
mv->setEndValue(QPoint(x-400,y-400));

mv->setLoopCount(3);
mv->start();

沒有留言:

張貼留言