Qt 4.8
|
The PropertyChanges element describes new property bindings or values for a state. More...
The PropertyChanges element describes new property bindings or values for a state.
PropertyChanges is used to define the property values or bindings in a State . This enables an item's property values to be changed when it QML States.
To create a PropertyChanges object, specify the target item whose properties are to be modified, and define the new property values or bindings. For example:
When the mouse is pressed, the Rectangle changes to the resized state. In this state, the PropertyChanges object sets the rectangle's color to blue and the height
value to that of container.height
.
Note this automatically binds rect.height
to container.height
in the resized state. If a property binding should not be established, and the height should just be set to the value of container.height
at the time of the state change, set the explicit property to true
.
A PropertyChanges object can also override the default signal handler for an object to implement a signal handler specific to the new state:
The undefined
value can be used to reset the property value for a state. In the following example, when theText
changes to the widerText state, its width
property is reset, giving the text its natural width and displaying the whole string on a single line.
When QML Animation and Transitions{Transitions} are used to animate state changes, they animate properties from their values in the current state to those defined in the new state (as defined by PropertyChanges objects). However, it is sometimes desirable to set a property value immediately during a Transition , without animation; in these cases, the PropertyAction element can be used to force an immediate property change.
See the PropertyAction documentation for more details.