smallB
smallB

Reputation: 17100

Bizzare error from Qt

Having this code executed in Qt editor:

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

I'm getting an pop up with error msg:

enter image description here

Upvotes: 0

Views: 96

Answers (1)

laurent
laurent

Reputation: 90736

You should always create your QWidgets on the heap, otherwise you'll indeed get all sorts of errors:

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

Upvotes: 1

Related Questions