Qt 4.8
|
The State element defines configurations of objects and properties. More...
The State element defines configurations of objects and properties.
A state is a set of batched changes from the default configuration.
All items have a default state that defines the default configuration of objects and property values. New states can be defined by adding State items to the Item::states{states} property to allow items to switch between different configurations. These configurations can, for example, be used to apply different sets of property values or execute different scripts.
The following example displays a single Rectangle . In the default state, the rectangle is colored black. In the "clicked" state, a PropertyChanges element changes the rectangle's color to red. Clicking within the MouseArea toggles the rectangle's state between the default state and the "clicked" state, thus toggling the color of the rectangle between black and red.
Notice the default state is referred to using an empty string ("").
States are commonly used together with QML Animation and Transitions{Transitions} to provide animations when state changes occur.