Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.8.x, 5.5.1
-
None
Description
If you create and start a new QPropertyAnimation in a slot connected to QPropertyAnimation::finished, and create a local event loop (possibly implicitly by using a QDialog), the new animation doesn't run. Testcase (probably also works with other animation classes)
testcase.cpp
#include <QPropertyAnimation> #include <QApplication> #include <QMessageBox> int main(int argc, char **argv) { QApplication qapp(argc, argv); QPropertyAnimation qa; qa.setProperty("foo", 1.0); qa.setTargetObject(&qa); qa.setPropertyName("foo"); qa.setStartValue(1.0); qa.setEndValue(0.0); qa.setDuration(50); qa.start(); QObject::connect(&qa, &QPropertyAnimation::finished, &qa, [&]{ QPropertyAnimation &qa = *new QPropertyAnimation; qa.setProperty("foo", 1.0); qa.setTargetObject(&qa); qa.setPropertyName("foo"); qa.setStartValue(1.0); qa.setEndValue(0.0); qa.setDuration(50); qa.start(); QObject::connect(&qa, &QPropertyAnimation::finished, &qa, []{ QMessageBox::information(nullptr, "Test", "Will not appear"); }); QMessageBox::information(nullptr, "Test", "Eventloop"); }); qapp.exec(); }
If you connect the finished of the first animation using Qt::QueuedConnection, it works like a charm.