summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-03 06:26:02 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-03 06:26:02 (GMT)
commit7c3fb4ae79b4d4c0831a75821ff256bd96f3003e (patch)
tree46257983d7689de187b81e45548cc3413468a839 /src/declarative/util
parent3a2f34545c7d020e69ce7f86bf593d53ad456946 (diff)
parentcece4361fc7048272c251ba19bb78fe236fc01c1 (diff)
downloadQt-7c3fb4ae79b4d4c0831a75821ff256bd96f3003e.zip
Qt-7c3fb4ae79b4d4c0831a75821ff256bd96f3003e.tar.gz
Qt-7c3fb4ae79b4d4c0831a75821ff256bd96f3003e.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlanimation.h10
-rw-r--r--src/declarative/util/qmlstate.cpp3
-rw-r--r--src/declarative/util/qmlstate.h1
-rw-r--r--src/declarative/util/qmlstateoperations.cpp99
-rw-r--r--src/declarative/util/qmlstateoperations.h13
5 files changed, 116 insertions, 10 deletions
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
index a898be8..7104f60 100644
--- a/src/declarative/util/qmlanimation.h
+++ b/src/declarative/util/qmlanimation.h
@@ -58,7 +58,7 @@ QT_MODULE(Declarative)
class QmlAbstractAnimationPrivate;
class QmlAnimationGroup;
-class QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus
+class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlAbstractAnimation)
@@ -68,8 +68,6 @@ class QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, publ
Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged())
Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged)
- //Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
- //Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
Q_CLASSINFO("DefaultMethod", "start()")
Q_INTERFACES(QmlParserStatus)
@@ -252,7 +250,7 @@ protected:
};
class QmlPropertyAnimationPrivate;
-class QmlPropertyAnimation : public QmlAbstractAnimation
+class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlPropertyAnimation)
@@ -304,7 +302,7 @@ Q_SIGNALS:
void propertiesChanged(const QString &);
};
-class QmlColorAnimation : public QmlPropertyAnimation
+class Q_AUTOTEST_EXPORT QmlColorAnimation : public QmlPropertyAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlPropertyAnimation)
@@ -322,7 +320,7 @@ public:
void setTo(const QColor &);
};
-class QmlNumberAnimation : public QmlPropertyAnimation
+class Q_AUTOTEST_EXPORT QmlNumberAnimation : public QmlPropertyAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlPropertyAnimation)
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 508ef43..da7d429 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -359,6 +359,9 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever
}
}
}
+ if (!found)
+ action.event->saveForwardBindings();
+ //### do we ever need to do saveForwardBindings when found == true?
} else {
action.fromBinding = action.property.binding();
diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h
index 0b48449..255051f 100644
--- a/src/declarative/util/qmlstate.h
+++ b/src/declarative/util/qmlstate.h
@@ -95,6 +95,7 @@ public:
virtual QList<Action> extraActions();
virtual bool changesBindings();
+ virtual void saveForwardBindings() {}
virtual void clearForwardBindings();
virtual void clearReverseBindings();
virtual bool override(ActionEvent*other);
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index 858a527..50f80f6 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -305,12 +305,19 @@ public:
QStringList resetList;
QFxAnchorLine left;
QFxAnchorLine right;
+ QFxAnchorLine horizontalCenter;
QFxAnchorLine top;
QFxAnchorLine bottom;
+ QFxAnchorLine verticalCenter;
+ QFxAnchorLine baseline;
+
QFxAnchorLine origLeft;
QFxAnchorLine origRight;
+ QFxAnchorLine origHCenter;
QFxAnchorLine origTop;
QFxAnchorLine origBottom;
+ QFxAnchorLine origVCenter;
+ QFxAnchorLine origBaseline;
qreal origX;
qreal origY;
qreal origWidth;
@@ -364,11 +371,15 @@ void QmlAnchorChanges::setReset(const QString &reset)
}
/*!
- \qmlproperty AnchorLine AnchorChanges::top
- \qmlproperty AnchorLine AnchorChanges::bottom
\qmlproperty AnchorLine AnchorChanges::left
\qmlproperty AnchorLine AnchorChanges::right
- These properties change the \e left, \e top, \e right and \e bottom anchors of the item
+ \qmlproperty AnchorLine AnchorChanges::horizontalCenter
+ \qmlproperty AnchorLine AnchorChanges::top
+ \qmlproperty AnchorLine AnchorChanges::bottom
+ \qmlproperty AnchorLine AnchorChanges::verticalCenter
+ \qmlproperty AnchorLine AnchorChanges::baseline
+
+ These properties change the respective anchors of the item.
*/
QFxAnchorLine QmlAnchorChanges::left() const
@@ -395,6 +406,18 @@ void QmlAnchorChanges::setRight(const QFxAnchorLine &edge)
d->right = edge;
}
+QFxAnchorLine QmlAnchorChanges::horizontalCenter() const
+{
+ Q_D(const QmlAnchorChanges);
+ return d->horizontalCenter;
+}
+
+void QmlAnchorChanges::setHorizontalCenter(const QFxAnchorLine &edge)
+{
+ Q_D(QmlAnchorChanges);
+ d->horizontalCenter = edge;
+}
+
QFxAnchorLine QmlAnchorChanges::top() const
{
Q_D(const QmlAnchorChanges);
@@ -419,6 +442,30 @@ void QmlAnchorChanges::setBottom(const QFxAnchorLine &edge)
d->bottom = edge;
}
+QFxAnchorLine QmlAnchorChanges::verticalCenter() const
+{
+ Q_D(const QmlAnchorChanges);
+ return d->verticalCenter;
+}
+
+void QmlAnchorChanges::setVerticalCenter(const QFxAnchorLine &edge)
+{
+ Q_D(QmlAnchorChanges);
+ d->verticalCenter = edge;
+}
+
+QFxAnchorLine QmlAnchorChanges::baseline() const
+{
+ Q_D(const QmlAnchorChanges);
+ return d->baseline;
+}
+
+void QmlAnchorChanges::setBaseline(const QFxAnchorLine &edge)
+{
+ Q_D(QmlAnchorChanges);
+ d->baseline = edge;
+}
+
void QmlAnchorChanges::execute()
{
Q_D(QmlAnchorChanges);
@@ -430,10 +477,16 @@ void QmlAnchorChanges::execute()
d->target->anchors()->setLeft(d->left);
if (d->right.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setRight(d->right);
+ if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->setHorizontalCenter(d->horizontalCenter);
if (d->top.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setTop(d->top);
if (d->bottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setBottom(d->bottom);
+ if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->setVerticalCenter(d->verticalCenter);
+ if (d->baseline.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->setBaseline(d->baseline);
}
bool QmlAnchorChanges::isReversable()
@@ -452,10 +505,16 @@ void QmlAnchorChanges::reverse()
d->target->anchors()->setLeft(d->origLeft);
if (d->origRight.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setRight(d->origRight);
+ if (d->origHCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->setHorizontalCenter(d->origHCenter);
if (d->origTop.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setTop(d->origTop);
if (d->origBottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->setBottom(d->origBottom);
+ if (d->origVCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->setVerticalCenter(d->origVCenter);
+ if (d->origBaseline.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->setBaseline(d->origBaseline);
}
QString QmlAnchorChanges::typeName() const
@@ -498,13 +557,21 @@ bool QmlAnchorChanges::changesBindings()
return true;
}
-void QmlAnchorChanges::clearForwardBindings()
+void QmlAnchorChanges::saveForwardBindings()
{
Q_D(QmlAnchorChanges);
d->origLeft = d->target->anchors()->left();
d->origRight = d->target->anchors()->right();
+ d->origHCenter = d->target->anchors()->horizontalCenter();
d->origTop = d->target->anchors()->top();
d->origBottom = d->target->anchors()->bottom();
+ d->origVCenter = d->target->anchors()->verticalCenter();
+ d->origBaseline = d->target->anchors()->baseline();
+}
+
+void QmlAnchorChanges::clearForwardBindings()
+{
+ Q_D(QmlAnchorChanges);
d->origX = d->target->x();
d->origY = d->target->y();
d->origWidth = d->target->width();
@@ -515,20 +582,32 @@ void QmlAnchorChanges::clearForwardBindings()
d->target->anchors()->resetLeft();
if (d->resetList.contains(QLatin1String("right")))
d->target->anchors()->resetRight();
+ if (d->resetList.contains(QLatin1String("horizontalCenter")))
+ d->target->anchors()->resetHorizontalCenter();
if (d->resetList.contains(QLatin1String("top")))
d->target->anchors()->resetTop();
if (d->resetList.contains(QLatin1String("bottom")))
d->target->anchors()->resetBottom();
+ if (d->resetList.contains(QLatin1String("verticalCenter")))
+ d->target->anchors()->resetVerticalCenter();
+ if (d->resetList.contains(QLatin1String("baseline")))
+ d->target->anchors()->resetBaseline();
//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->horizontalCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetHorizontalCenter();
if (d->top.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetTop();
if (d->bottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetBottom();
+ if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetVerticalCenter();
+ if (d->baseline.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetBaseline();
}
void QmlAnchorChanges::clearReverseBindings()
@@ -544,20 +623,32 @@ void QmlAnchorChanges::clearReverseBindings()
d->target->anchors()->resetLeft();
if (d->right.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetRight();
+ if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetHorizontalCenter();
if (d->top.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetTop();
if (d->bottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetBottom();
+ if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetVerticalCenter();
+ if (d->baseline.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetBaseline();
//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->origHCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetHorizontalCenter();
if (d->origTop.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetTop();
if (d->origBottom.anchorLine != QFxAnchorLine::Invalid)
d->target->anchors()->resetBottom();
+ if (d->origVCenter.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetVerticalCenter();
+ if (d->origBaseline.anchorLine != QFxAnchorLine::Invalid)
+ d->target->anchors()->resetBaseline();
}
bool QmlAnchorChanges::override(ActionEvent*other)
diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations.h
index afe0bd5..a3943e7 100644
--- a/src/declarative/util/qmlstateoperations.h
+++ b/src/declarative/util/qmlstateoperations.h
@@ -113,8 +113,11 @@ class Q_DECLARATIVE_EXPORT QmlAnchorChanges : public QmlStateOperation, public A
Q_PROPERTY(QString reset READ reset WRITE setReset)
Q_PROPERTY(QFxAnchorLine left READ left WRITE setLeft)
Q_PROPERTY(QFxAnchorLine right READ right WRITE setRight)
+ Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter)
Q_PROPERTY(QFxAnchorLine top READ top WRITE setTop)
Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom)
+ Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter)
+ Q_PROPERTY(QFxAnchorLine baseline READ baseline WRITE setBaseline)
public:
QmlAnchorChanges(QObject *parent=0);
@@ -134,12 +137,21 @@ public:
QFxAnchorLine right() const;
void setRight(const QFxAnchorLine &edge);
+ QFxAnchorLine horizontalCenter() const;
+ void setHorizontalCenter(const QFxAnchorLine &edge);
+
QFxAnchorLine top() const;
void setTop(const QFxAnchorLine &edge);
QFxAnchorLine bottom() const;
void setBottom(const QFxAnchorLine &edge);
+ QFxAnchorLine verticalCenter() const;
+ void setVerticalCenter(const QFxAnchorLine &edge);
+
+ QFxAnchorLine baseline() const;
+ void setBaseline(const QFxAnchorLine &edge);
+
virtual void execute();
virtual bool isReversable();
virtual void reverse();
@@ -147,6 +159,7 @@ public:
virtual bool override(ActionEvent*other);
virtual QList<Action> extraActions();
virtual bool changesBindings();
+ virtual void saveForwardBindings();
virtual void clearForwardBindings();
virtual void clearReverseBindings();
};