QPropertyAnimation and QGraphicsObject.



  • I was look for a list of supported QPropertyAnimation for the QGraphicsObject. I need to apply a "scale animation" to the QGraphicsObject. Is it possible?



  • Yes, indeed. Try something like this:

    @QPropertyAnimation *animation = new QPropertyAnimation(graphicsObject, "scale");
    animation->setDuration(animationTimeMs);

    animation->setKeyValueAt(0.0, 1.0);
    animation->setKeyValueAt(0.5, 2.0);
    animation->setKeyValueAt(1.0, 1.0);

    // You can also use interpolation:
    // animation->setEasingCurve(QEasingCurve::InOutQuint);

    animation->start(QAbstractAnimation::DeleteWhenStopped);@



  • Thank you. Indeed it is quite simple. can QPropertyAnimation used in combination with QAnimationGroup in order to translate and scale the same QGraphicsObject. I could see the scale property but nothing about translate. Should I go with the x and y properties?

    Thank you



  • Another questiom @QAbstractAnimation::DeleteWhenStopped@ means that the Animation itself will deallocate from the heap when it finished, or Should I care to delete the animation instance?



  • I think you can use the property "pos" or even "geometry" for that kind of operations instead of using "scale".
    Take a look at the reference:
    http://doc.qt.nokia.com/4.7/qpropertyanimation.html

    I never used QAnimationGroup but reading the reference it seems that it can be used there...

    And yes, @QAbstractAnimation::DeleteWhenStopped@ deletes the animation when finished.



  • ok, thank you....


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.