Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Do QPropertyAnimations delete themselves once they are finished?



  • Hi,

    If I create a QPropertyAnimation pointer and use it, is it automatically deleted when it's finished? If not, does Qt take care of it so that I don't have to worry about it?

    	QPropertyAnimation *anim = new QPropertyAnimation(object, "property_name");
    	anim->setDuration(5000);
    	anim->setEndValue(1.);
    	anim->start();
    

    What happens to anim once it has reached its end value?


  • Lifetime Qt Champion

    Hi,

    For automatic deletion of the animation, you can set the animation deletion policy to DeleteWhenStopped.


Log in to reply