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

A third way of animation

Besides QTimer and QPropertyAnimation, there is a third way to animate the scene. The scene provides a slot called advance(). If you call that slot, the scene will forward that call to all items it holds by calling advance() on each one. The scene does that twice. First, all item advance() functions are called with 0 as an argument. This means that the items are about to advance. Then, in the second round, all items are called passing 1 to the item's advance() function. In that phase, each item should advance, whatever that means—maybe moving, maybe a color change, and so on. The scene's slot advance is typically called by a QTimeLine element; with this, you can define how many times during a specific period of time ...

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