16,240
社区成员
发帖
与我相关
我的任务
分享
class MainWindow : public QWidget
{
public:
MainWindow(QWidget *parent = 0) : QWidget(parent)
{
QLabel *tootbtn = new QLabel("",this);
tootbtn->setPixmap(QPixmap("E:/QTLearning/wxq2.jpg" ));
QPropertyAnimation *anim = new QPropertyAnimation(tootbtn, "geometry" );
anim->setStartValue(QRect(-400,200,600,620));
anim->setKeyValueAt(.8, QRect(1600,200,600,620));
anim->setEndValue(QRect(800,200,600,620));
anim->setDuration(2000);
anim->setEasingCurve(QEasingCurve::InBounce);
anim->start();
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
MainWindow window;
window.showMaximized();
return app.exec();
}