diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-21 13:32:04 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-21 13:32:04 (GMT) |
commit | b05e07835c376857da0a0f9cb85bbab001f145dd (patch) | |
tree | d3efb13f1e00515f3deabfc6da1eb381472dac37 /src/declarative/util/qdeclarativebehavior.cpp | |
parent | 3a7b70637f94a85702c6578bb13a1e6594358d08 (diff) | |
parent | 2c6312bcb2a80431e6f0cf16d6c4c1d016d40b03 (diff) | |
download | Qt-b05e07835c376857da0a0f9cb85bbab001f145dd.zip Qt-b05e07835c376857da0a0f9cb85bbab001f145dd.tar.gz Qt-b05e07835c376857da0a0f9cb85bbab001f145dd.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (26 commits)
Expand QDeclarativeExtensionPlugin docs
Add missing snippet files
Expand QtObject doc
Indicate default values
Use snippets instead to avoid quoting license headers
Rename remaining 'wantsFocus'.
Bounding rect of text was not always calculated correctly.
Add QML tutorials to the tutorials page
QML focus API updates.
Do not show copyright header in documentation.
Ensure redirects (and indeed all reply process) is done in the right thread.
Only ignore the same target value for a Behavior when it is running.
Fix clock example: make sure hands always moves forward.
font.letterSpacing used percentage rather than absolute values.
Rewinding AnchorChanges should not make target item's implicit width and height explicit
Compile: include <float.h> for usage of FLT_MAX.
Restore the FLT_MAX define.
Make Item::transformOriginPoint read-only
Ensure the boundingRect() of Text is correctly calculated.
Better defaults for MouseArea's drag.
...
Diffstat (limited to 'src/declarative/util/qdeclarativebehavior.cpp')
-rw-r--r-- | src/declarative/util/qdeclarativebehavior.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index 2bb28c3..fadb2ae 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -75,28 +75,21 @@ public: \since 4.7 \brief The Behavior element allows you to specify a default animation for a property change. - Behaviors provide one way to specify \l{qdeclarativeanimation.html}{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: - \code - Rectangle { - width: 20; height: 20 - color: "#00ff00" - y: 200 // initial value - Behavior on y { - NumberAnimation { - easing.type: Easing.OutBounce - easing.amplitude: 100 - duration: 200 - } - } - } - \endcode + A Behavior defines the default animation to be applied whenever a + particular property value changes. + + For example, the following Behavior defines a NumberAnimation to be run + whenever the \l Rectangle's \c width value changes. When the MouseArea + is clicked, the \c width is changed, triggering the behavior's animation: + + \snippet doc/src/snippets/declarative/behavior.qml 0 - Currently only a single Behavior may be specified for a property; - this Behavior can be enabled and disabled via the \l{enabled} property. + To run multiple animations within a Behavior, use ParallelAnimation or + SequentialAnimation. - \sa {declarative/animation/behaviors}{Behavior example}, QtDeclarative + Note that a property cannot have more than one assigned Behavior. + + \sa {Property Behaviors}, {declarative/animation/behaviors}{Behavior example}, QtDeclarative */ @@ -113,7 +106,7 @@ QDeclarativeBehavior::~QDeclarativeBehavior() \qmlproperty Animation Behavior::animation \default - The animation to use when the behavior is triggered. + This property holds the animation to run when the behavior is triggered. */ QDeclarativeAbstractAnimation *QDeclarativeBehavior::animation() @@ -152,7 +145,9 @@ void QDeclarativeBehavior::qtAnimationStateChanged(QAbstractAnimation::State new /*! \qmlproperty bool Behavior::enabled - Whether the Behavior will be triggered when the property it is tracking changes. + + This property holds whether the behavior will be triggered when the tracked + property changes value. By default a Behavior is enabled. */ @@ -182,7 +177,7 @@ void QDeclarativeBehavior::write(const QVariant &value) return; } - if (value == d->targetValue) + if (d->animation->isRunning() && value == d->targetValue) return; d->currentValue = d->property.read(); |