O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What just happened?

You already know how to set up a single property animation, so we omitted the code for it. After setting up both animations, we add them to the group animation by calling addAnimation() on the group, while passing a pointer to the animation we would like to add. Then, when we start the group; QParallelAnimationGroup ensures that all assigned animations start at the same time.

When both animations have finished, group will emit the finished() signal. We connected that signal to the deleteLater() slot of our class so that the coin object gets deleted when it's no longer visible. This handy slot is declared in the QObject class and is useful in many cases.

In some cases, you may want to stop an animation. You can do that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required