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 ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.