diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-15 17:00:07 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-15 17:00:07 (GMT) |
commit | 737c0c8d9aa319384ef0bcbed4e709deb2239e75 (patch) | |
tree | 4776d0ff27ed18e57c298f1ac99a9c57a0d5eea6 /src/declarative/util/qdeclarativeanimation.cpp | |
parent | 33c6983a19942c151fa0bcc878b5219e0b641ba9 (diff) | |
parent | 83fe3a8e1f12ddfb6fc8d42f007816c122bed94d (diff) | |
download | Qt-737c0c8d9aa319384ef0bcbed4e709deb2239e75.zip Qt-737c0c8d9aa319384ef0bcbed4e709deb2239e75.tar.gz Qt-737c0c8d9aa319384ef0bcbed4e709deb2239e75.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: (89 commits)
Compile with user defined Qt namespace
Fix regression from previous commit
Import "content" with as qualifier to support network without qmldir
Small fixes to photoviewer demo
Fix benchmark.
Add basic QUrl benchmarks.
Add busy indicator to photoviewer demo
Set maximumExtents correctly for highlightRangeMode: StrictlyEnforceRange
fix installation of imports libraries
QDeclarative::isWritable optimization.
Make easing docs more consistent with other grouped property docs.
Make the loader a focusscope.
Fix typo.
Use reliable local server for HTTP testing.
Fix installation of imports libraries
Change PathView offset property to use range 0 - 1.0
Tweak benchmark
Optimization: Use linked list for context children
Add new declarative photoviewer demo
Remove dead code
...
Diffstat (limited to 'src/declarative/util/qdeclarativeanimation.cpp')
-rw-r--r-- | src/declarative/util/qdeclarativeanimation.cpp | 110 |
1 files changed, 106 insertions, 4 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index 20449d7..009e07f 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -1877,13 +1877,17 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t) } /*! - \qmlproperty QEasingCurve PropertyAnimation::easing - \brief the easing curve used for the transition. + \qmlproperty enum PropertyAnimation::easing.type + \qmlproperty real PropertyAnimation::easing.amplitude + \qmlproperty real PropertyAnimation::easing.overshoot + \qmlproperty real PropertyAnimation::easing.period + \brief the easing curve used for the animation. - For the easing you can specify the following parameters: type, amplitude, period and overshoot. + To specify an easing curve you need to specify at least the type. For some curves you can also specify + amplitude, period and/or overshoot (more details provided after the table). \qml - PropertyAnimation { properties: "y"; easing.type: "InOutElastc"; easing.amplitude: 2.0; easing.period: 1.5 } + PropertyAnimation { properties: "y"; easing.type: "InOutElastic"; easing.amplitude: 2.0; easing.period: 1.5 } \endqml Available types are: @@ -2447,12 +2451,15 @@ QDeclarativeParentAnimation::QDeclarativeParentAnimation(QObject *parent) QDeclarative_setParent_noEvent(d->topLevelGroup, this); d->startAction = new QActionAnimation; + QDeclarative_setParent_noEvent(d->startAction, d->topLevelGroup); d->topLevelGroup->addAnimation(d->startAction); d->ag = new QParallelAnimationGroup; + QDeclarative_setParent_noEvent(d->ag, d->topLevelGroup); d->topLevelGroup->addAnimation(d->ag); d->endAction = new QActionAnimation; + QDeclarative_setParent_noEvent(d->endAction, d->topLevelGroup); d->topLevelGroup->addAnimation(d->endAction); } @@ -2743,4 +2750,99 @@ QAbstractAnimation *QDeclarativeParentAnimation::qtAnimation() return d->topLevelGroup; } +/*! + \qmlclass AnchorAnimation QDeclarativeAnchorAnimation + \since 4.7 + \inherits Animation + \brief The AnchorAnimation element allows you to animate anchor changes. + + AnchorAnimation will animated any changes specified by a state's AnchorChanges. + In the following snippet we animate the addition of a right anchor to our item. + \qml + Item { + id: myItem + width: 100 + } + ... + State { + AnchorChanges { + target: myItem + anchors.right: container.right + } + } + ... + Transition { + //smoothly reanchor myItem and move into new position + AnchorAnimation {} + } + \endqml + + \sa AnchorChanges +*/ + +QDeclarativeAnchorAnimation::QDeclarativeAnchorAnimation(QObject *parent) +: QDeclarativeAbstractAnimation(*(new QDeclarativeAnchorAnimationPrivate), parent) +{ + Q_D(QDeclarativeAnchorAnimation); + d->va = new QDeclarativeBulkValueAnimator; + QDeclarative_setParent_noEvent(d->va, this); +} + +QDeclarativeAnchorAnimation::~QDeclarativeAnchorAnimation() +{ +} + +QAbstractAnimation *QDeclarativeAnchorAnimation::qtAnimation() +{ + Q_D(QDeclarativeAnchorAnimation); + return d->va; +} + +/*! + \qmlproperty list<Item> AnchorAnimation::targets + The items to reanchor. + + If no targets are specified all AnchorChanges will be + animated by the AnchorAnimation. +*/ +QDeclarativeListProperty<QDeclarativeItem> QDeclarativeAnchorAnimation::targets() +{ + Q_D(QDeclarativeAnchorAnimation); + return QDeclarativeListProperty<QDeclarativeItem>(this, d->targets); +} + +void QDeclarativeAnchorAnimation::transition(QDeclarativeStateActions &actions, + QDeclarativeProperties &modified, + TransitionDirection direction) +{ + Q_D(QDeclarativeAnchorAnimation); + PropertyUpdater *data = new PropertyUpdater; + data->interpolatorType = QMetaType::QReal; + data->interpolator = d->interpolator; + + data->reverse = direction == Backward ? true : false; + data->fromSourced = false; + data->fromDefined = false; + + for (int ii = 0; ii < actions.count(); ++ii) { + QDeclarativeAction &action = actions[ii]; + if (action.event && action.event->typeName() == QLatin1String("AnchorChanges") + && (d->targets.isEmpty() || d->targets.contains(static_cast<QDeclarativeAnchorChanges*>(action.event)->object()))) { + data->actions << static_cast<QDeclarativeAnchorChanges*>(action.event)->additionalActions(); + } + } + + if (data->actions.count()) { + if (!d->rangeIsSet) { + d->va->setStartValue(qreal(0)); + d->va->setEndValue(qreal(1)); + d->rangeIsSet = true; + } + d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped); + d->va->setFromSourcedValue(&data->fromSourced); + } else { + delete data; + } +} + QT_END_NAMESPACE |