16,239
社区成员
发帖
与我相关
我的任务
分享
QPushButton *button1 = new QPushButton(uhomeBackWidget);
button1->move(0,0);
button1->resize(30,30);
button1->show();
QLabel *label = new QLabel("xyz",uhomeBackWidget);
label->move(100,100);
label->resize(30,30);
label->show();
//为图形项的rotation属性创建动画
QPropertyAnimation *animation =new QPropertyAnimation(button1,"rotation");
animation->setDuration(6000);
//animation->setStartValue(QRect(0,0,30,30));
//animation->setEndValue(QRect(360,360,30,30));
animation->setStartValue(0);
animation->setEndValue(360);
animation->setLoopCount(-1);
animation->start(QAbstractAnimation::KeepWhenStopped);
QGraphicsScene scene;
scene.setSceneRect(-200,-200,400,400);
MyItem *item = new MyItem;
scene.addItem(item);
QGraphicsView view;
view.setScene(&scene);
view.show();
//为图形项的rotation属性创建动画
QPropertyAnimation *animation =new QPropertyAnimation(item ,"rotation");
animation->setDuration(6000);
//animation->setStartValue(QRect(0,0,30,30));
//animation->setEndValue(QRect(360,360,30,30));
animation->setStartValue(0);
animation->setEndValue(360);
animation->setLoopCount(-1);
animation->start(QAbstractAnimation::KeepWhenStopped);