summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-08-31 03:02:02 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-08-31 03:02:02 (GMT)
commit25dffe6b5367518486edf8a91d5674be4852c50e (patch)
tree85d75144b88844b0212cf45cee9f3790288e75dc /src/declarative/util
parentcb9ce64d9a233f6c53b5961cfe637ccc2ac6fa69 (diff)
downloadQt-25dffe6b5367518486edf8a91d5674be4852c50e.zip
Qt-25dffe6b5367518486edf8a91d5674be4852c50e.tar.gz
Qt-25dffe6b5367518486edf8a91d5674be4852c50e.tar.bz2
More robust AnchorChanges.
Still not completely reliable -- doesn't handle cancellations well, and checking if one Anchor change overrides another isn't reliable.
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlanimation.cpp4
-rw-r--r--src/declarative/util/qmlstateoperations.cpp32
-rw-r--r--src/declarative/util/qmlstateoperations.h1
3 files changed, 34 insertions, 3 deletions
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 02b747f..d224388 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -1425,11 +1425,11 @@ void QmlParallelAnimation::transition(QmlStateActions &actions,
{
Q_D(QmlAnimationGroup);
- //needed for Behavior
+ //needed for Behavior
if (d->userProperty.isValid() && d->propertyName.isEmpty() && !target()) {
for (int i = 0; i < d->animations.count(); ++i)
d->animations.at(i)->setTarget(d->userProperty);
- }
+ }
for (int ii = 0; ii < d->animations.count(); ++ii) {
d->animations.at(ii)->transition(actions, modified, direction);
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index b17b80b..e10c9ab 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -439,7 +439,6 @@ void QmlAnchorChanges::reverse()
d->target->anchors()->setTop(d->origTop);
if (d->origBottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setBottom(d->origBottom);
-
}
QString QmlAnchorChanges::typeName() const
@@ -503,6 +502,16 @@ void QmlAnchorChanges::clearForwardBindings()
d->target->anchors()->resetTop();
if (d->resetList.contains(QLatin1String("bottom")))
d->target->anchors()->resetBottom();
+
+ //reset any anchors that we'll be setting in the state
+ if (d->left.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetLeft();
+ if (d->right.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetRight();
+ if (d->top.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetTop();
+ if (d->bottom.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetBottom();
}
void QmlAnchorChanges::clearReverseBindings()
@@ -522,6 +531,27 @@ void QmlAnchorChanges::clearReverseBindings()
d->target->anchors()->resetTop();
if (d->bottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetBottom();
+
+ //reset any anchors that were set in the original state
+ if (d->origLeft.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetLeft();
+ if (d->origRight.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetRight();
+ if (d->origTop.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetTop();
+ if (d->origBottom.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetBottom();
+}
+
+bool QmlAnchorChanges::override(ActionEvent*other)
+{
+ if (other->typeName() != QLatin1String("AnchorChanges"))
+ return false;
+ if (static_cast<ActionEvent*>(this) == other)
+ return true;
+ //### can we do any other meaningful comparison? Do we need to attempt to merge the two
+ // somehow if they have the same target and some of the same anchors?
+ return false;
}
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h
index 3018b44..afe0bd5 100644
--- a/src/declarative/util/qmlstateoperations.h
+++ b/src/declarative/util/qmlstateoperations.h
@@ -144,6 +144,7 @@ public:
virtual bool isReversable();
virtual void reverse();
virtual QString typeName() const;
+ virtual bool override(ActionEvent*other);
virtual QList<Action> extraActions();
virtual bool changesBindings();
virtual void clearForwardBindings();