Qt Reference Documentation

QML Behavior Element

The Behavior element allows you to specify a default animation for a property change. More...

Properties

Detailed Description

Behaviors provide one way to specify animations in QML.

In the example below, the rectangle will use a bounce easing curve over 200 millisecond for any changes to its y property:

 Rectangle {
     width: 20; height: 20
     color: "#00ff00"
     y: 200  // initial value
     Behavior on y {
         NumberAnimation {
             easing.type: Easing.OutBounce
             easing.amplitude: 100
             duration: 200
         }
     }
 }

Currently only a single Behavior may be specified for a property; this Behavior can be enabled and disabled via the enabled property.

See also QtDeclarative.


Property Documentation

defaultanimation : Animation

The animation to use when the behavior is triggered.


enabled : bool

Whether the Behavior will be triggered when the property it is tracking changes.

By default a Behavior is enabled.


X