在Qt编辑器中执行此代码:
QPushButton button("Animated Button");
button.show();
QPropertyAnimation animation(&button, "geometry");
animation.setDuration(3000);
animation.setStartValue(QRect(0, 0, 100, 30));
animation.setEndValue(QRect(250, 250, 100, 30));
animation.setEasingCurve(QEasingCurve::OutBounce);
animation.start();
我弹出错误消息:
答案 0 :(得分:1)
你应该总是在堆上创建你的QWidgets,否则你确实会遇到各种各样的错误:
QPushButton* button = new QPushButton("Animated Button");