来自Qt的奇怪错误

时间:2011-08-13 14:29:55

标签: c++ qt

在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();

我弹出错误消息:

enter image description here

1 个答案:

答案 0 :(得分:1)

你应该总是在堆上创建你的QWidgets,否则你确实会遇到各种各样的错误:

QPushButton* button = new QPushButton("Animated Button");