diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-03-23 04:30:45 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-03-23 04:30:45 (GMT) |
commit | ceebd7298e8d2325956e297c46a965d68c56b02f (patch) | |
tree | ab583a0437e12d2c5645537ebf90e202576e9935 /src/declarative | |
parent | 714fac87324b9007e5f82487d2c4a10b1997616e (diff) | |
download | Qt-ceebd7298e8d2325956e297c46a965d68c56b02f.zip Qt-ceebd7298e8d2325956e297c46a965d68c56b02f.tar.gz Qt-ceebd7298e8d2325956e297c46a965d68c56b02f.tar.bz2 |
Change default RotationAnimation direction.
Shortest as default too often led to unintuitive behavior. For example,
RotationAnimation { from: 0; to: 360 } will not animate at all. Numerical
gives the least surprising results.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qdeclarativeanimation.cpp | 13 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativeanimation_p_p.h | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index f644917..1fb3d99 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1136,9 +1136,10 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) \brief The RotationAnimation element allows you to animate rotations. RotationAnimation is a specialized PropertyAnimation that gives control - over the direction of rotation. By default, it will rotate - via the shortest path; for example, a rotation from 20 to 340 degrees will - rotation 40 degrees counterclockwise. + over the direction of rotation. By default, it will rotate in the direction + of the numerical change; a rotation from 0 to 240 will rotate 220 degrees + clockwise, while a rotation from 240 to 0 will rotate 220 degrees + counterclockwise. When used in a transition RotationAnimation will rotate all properties named "rotation" or "angle". You can override this by providing @@ -1153,7 +1154,7 @@ void QDeclarativeVector3dAnimation::setTo(QVector3D t) State { name: "-90"; PropertyChanges { target: myItem; rotation: -90 } } } transition: Transition { - RotationAnimation { } + RotationAnimation { direction: RotationAnimation.Shortest } } \endqml */ @@ -1205,7 +1206,7 @@ QDeclarativeRotationAnimation::QDeclarativeRotationAnimation(QObject *parent) { Q_D(QDeclarativeRotationAnimation); d->interpolatorType = QMetaType::QReal; - d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&_q_interpolateShortestRotation); + d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType); d->defaultProperties = QLatin1String("rotation,angle"); } @@ -1268,7 +1269,7 @@ void QDeclarativeRotationAnimation::setTo(qreal t) A rotation from 10 to 350 will rotate 20 degrees counterclockwise. \endtable - The default direction is Shortest. + The default direction is Numerical. */ QDeclarativeRotationAnimation::RotationDirection QDeclarativeRotationAnimation::direction() const { diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h index 8ed745d..55aacfa 100644 --- a/src/declarative/util/qdeclarativeanimation_p_p.h +++ b/src/declarative/util/qdeclarativeanimation_p_p.h @@ -353,7 +353,7 @@ class QDeclarativeRotationAnimationPrivate : public QDeclarativePropertyAnimatio { Q_DECLARE_PUBLIC(QDeclarativeRotationAnimation) public: - QDeclarativeRotationAnimationPrivate() : direction(QDeclarativeRotationAnimation::Shortest) {} + QDeclarativeRotationAnimationPrivate() : direction(QDeclarativeRotationAnimation::Numerical) {} QDeclarativeRotationAnimation::RotationDirection direction; }; |