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

States and transitions

Qt Quick introduces a concept of states. Any Qt Quick object can have a predefined set of states. Each state corresponds to a certain situation in the application logic. For example, we can say that our calculator application has two states:

  • When add or multiply operations are selected, the user has to input two operands
  • When factorial operation is selected, the user has to input only one operand

States are identified by string names. Implicitly, any object has the base state with an empty name. To declare a new state, you need to specify the state name and a set of property values that are different in that state, compared to the base state.

Each Qt Quick object also has the state property. When you assign a state ...

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