QTineline的setFrameRange用法
刚才看程序,对setFrameRange 不是很了解,请帮忙指教一下,代码如下:
#include <QtGui/QApplication>
#include <QGraphicsItem>
#include <QTimeLine>
#include <QGraphicsItemAnimation>
#include <QGraphicsView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);//创建一个椭圆Item
QTimeLine *timer = new QTimeLine(5000);
timer->setFrameRange(0, 400); //不明白这个Range是干嘛用的
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(ball);
animation->setTimeLine(timer);
for (int i = 0; i < 600; ++i)
animation->setPosAt(i / 600.0, QPointF(i, i));
QGraphicsScene *scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 650, 650);
scene->addItem(ball);
QGraphicsView *view = new QGraphicsView(scene);
view->show();
timer->start();
return a.exec();
}
请问下 setFrameRange 字面理解是设置帧的范围,可 设置谁的帧??,
如果我用 setFrameRange(0,400)和 setFrameRange(200,400) 这两个函数有什么区别,谢谢!
这个函数不要是不是也一样,谢谢!