c++ - 来自 Qt 的 Bizzare 错误

标签 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

最佳答案

您应该始终在堆上创建 QWidget,否则您确实会遇到各种错误:

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

关于c++ - 来自 Qt 的 Bizzare 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7051036/

相关文章:

qt - QSlider 做了不必要的步骤

c++ - 您可以将指针传递给 std::vector 的迭代器吗

c++ - 如何知道自己进程打开的各种文件是什么

c++ - 在 C++ 异常处理程序中嵌套 try...catch?

c++ - Qt 如何使用带有 QColor 的 RGB 颜色创建 QBrush 并在以后更改它?

C++ 使用一种方法且没有警告地实现不同类型赋值的优雅方法?

c++ - Qt - 引用项目的 main() 函数覆盖了实际项目的 main()

python - PyQt 剪贴板不会复制到系统剪贴板

c++ - qt binarycreator 不创建 dmg

c++ - rsyslog 写入同步文件不会阻塞