summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp35
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h18
-rw-r--r--src/declarative/util/qdeclarativeanimation_p_p.h4
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp11
-rw-r--r--src/declarative/util/qdeclarativebehavior_p.h2
-rw-r--r--src/declarative/util/qdeclarativebind.cpp4
-rw-r--r--src/declarative/util/qdeclarativeconnection.cpp4
-rw-r--r--src/declarative/util/qdeclarativeeasefollow.cpp6
-rw-r--r--src/declarative/util/qdeclarativeeasefollow_p.h4
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp59
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp4
-rw-r--r--src/declarative/util/qdeclarativespringfollow_p.h2
-rw-r--r--src/declarative/util/qdeclarativestate.cpp6
-rw-r--r--src/declarative/util/qdeclarativestate_p.h4
-rw-r--r--src/declarative/util/qdeclarativestate_p_p.h8
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp31
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp2
-rw-r--r--src/declarative/util/qdeclarativetransition_p.h2
-rw-r--r--src/declarative/util/qdeclarativetransitionmanager.cpp21
19 files changed, 128 insertions, 99 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 9e777a0..264b88c 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -52,6 +52,7 @@
#include <qdeclarativestringconverters_p.h>
#include <qdeclarativeglobal_p.h>
#include <qdeclarativemetatype_p.h>
+#include <qdeclarativeproperty_p.h>
#include <qvariant.h>
#include <qcolor.h>
@@ -144,7 +145,7 @@ void QDeclarativeAbstractAnimationPrivate::commence()
Q_Q(QDeclarativeAbstractAnimation);
QDeclarativeStateActions actions;
- QDeclarativeMetaProperties properties;
+ QDeclarativeProperties properties;
q->transition(actions, properties, QDeclarativeAbstractAnimation::Forward);
q->qtAnimation()->start();
@@ -154,15 +155,15 @@ void QDeclarativeAbstractAnimationPrivate::commence()
}
}
-QDeclarativeMetaProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
+QDeclarativeProperty QDeclarativeAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
{
- QDeclarativeMetaProperty prop(obj, str, qmlContext(infoObj));
+ QDeclarativeProperty prop(obj, str, qmlContext(infoObj));
if (!prop.isValid()) {
qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate non-existent property \"%1\"").arg(str);
- return QDeclarativeMetaProperty();
+ return QDeclarativeProperty();
} else if (!prop.isWritable()) {
qmlInfo(infoObj) << QDeclarativeAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
- return QDeclarativeMetaProperty();
+ return QDeclarativeProperty();
}
return prop;
}
@@ -465,7 +466,7 @@ void QDeclarativeAbstractAnimation::complete()
}
}
-void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeMetaProperty &p)
+void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeProperty &p)
{
Q_D(QDeclarativeAbstractAnimation);
d->defaultProperty = p;
@@ -479,7 +480,7 @@ void QDeclarativeAbstractAnimation::setTarget(const QDeclarativeMetaProperty &p)
so this function allows us to do the same thing as setTarget without
that assumption
*/
-void QDeclarativeAbstractAnimation::setDefaultTarget(const QDeclarativeMetaProperty &p)
+void QDeclarativeAbstractAnimation::setDefaultTarget(const QDeclarativeProperty &p)
{
Q_D(QDeclarativeAbstractAnimation);
d->defaultProperty = p;
@@ -497,7 +498,7 @@ void QDeclarativeAbstractAnimation::setDisableUserControl()
}
void QDeclarativeAbstractAnimation::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_UNUSED(actions);
@@ -728,7 +729,7 @@ void QDeclarativeScriptActionPrivate::execute()
}
void QDeclarativeScriptAction::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_D(QDeclarativeScriptAction);
@@ -911,7 +912,7 @@ QAbstractAnimation *QDeclarativePropertyAction::qtAnimation()
}
void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_D(QDeclarativePropertyAction);
@@ -924,7 +925,7 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
{
for (int ii = 0; ii < actions.count(); ++ii) {
const QDeclarativeAction &action = actions.at(ii);
- action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
}
};
@@ -1132,7 +1133,7 @@ QAbstractAnimation *QDeclarativeParentAction::qtAnimation()
}
void QDeclarativeParentAction::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_D(QDeclarativeParentAction);
@@ -1581,7 +1582,7 @@ QAbstractAnimation *QDeclarativeSequentialAnimation::qtAnimation()
}
void QDeclarativeSequentialAnimation::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_D(QDeclarativeAnimationGroup);
@@ -1646,7 +1647,7 @@ QAbstractAnimation *QDeclarativeParallelAnimation::qtAnimation()
}
void QDeclarativeParallelAnimation::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_D(QDeclarativeAnimationGroup);
@@ -2230,7 +2231,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue
QDeclarativeAction &action = actions[ii];
if (v == 1.)
- action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
else {
if (!fromSourced && !fromDefined) {
action.fromValue = action.property.read();
@@ -2245,7 +2246,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue
}
}
if (interpolator)
- action.property.write(interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, interpolator(action.fromValue.constData(), action.toValue.constData(), v), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
if (deleted)
return;
@@ -2256,7 +2257,7 @@ struct PropertyUpdater : public QDeclarativeTimeLineValue
};
void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction)
{
Q_D(QDeclarativePropertyAnimation);
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 02dacb3..53afbb5 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -95,7 +95,7 @@ public:
QDeclarativeAnimationGroup *group() const;
void setGroup(QDeclarativeAnimationGroup *);
- void setDefaultTarget(const QDeclarativeMetaProperty &);
+ void setDefaultTarget(const QDeclarativeProperty &);
void setDisableUserControl();
void classBegin();
@@ -123,7 +123,7 @@ protected:
public:
enum TransitionDirection { Forward, Backward };
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation() = 0;
@@ -131,7 +131,7 @@ private Q_SLOTS:
void timelineComplete();
private:
- virtual void setTarget(const QDeclarativeMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
};
class QDeclarativePauseAnimationPrivate;
@@ -177,7 +177,7 @@ public:
protected:
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
};
@@ -221,7 +221,7 @@ Q_SIGNALS:
protected:
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
};
@@ -248,7 +248,7 @@ public:
protected:
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
};
@@ -300,7 +300,7 @@ public:
protected:
QDeclarativePropertyAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent);
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
@@ -426,7 +426,7 @@ public:
protected:
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
};
@@ -442,7 +442,7 @@ public:
protected:
virtual void transition(QDeclarativeStateActions &actions,
- QDeclarativeMetaProperties &modified,
+ QDeclarativeProperties &modified,
TransitionDirection direction);
virtual QAbstractAnimation *qtAnimation();
};
diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h
index 65c9807..fc4e6e6 100644
--- a/src/declarative/util/qdeclarativeanimation_p_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p_p.h
@@ -226,11 +226,11 @@ public:
void commence();
- QDeclarativeMetaProperty defaultProperty;
+ QDeclarativeProperty defaultProperty;
QDeclarativeAnimationGroup *group;
- static QDeclarativeMetaProperty createProperty(QObject *obj, const QString &str, QObject *infoObj);
+ static QDeclarativeProperty createProperty(QObject *obj, const QString &str, QObject *infoObj);
};
class QDeclarativePauseAnimationPrivate : public QDeclarativeAbstractAnimationPrivate
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index 303018d..e0189dc 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -46,6 +46,7 @@
#include <qdeclarativecontext.h>
#include <qdeclarativeinfo.h>
+#include <qdeclarativeproperty_p.h>
#include <QtCore/qparallelanimationgroup.h>
@@ -61,7 +62,7 @@ class QDeclarativeBehaviorPrivate : public QObjectPrivate
public:
QDeclarativeBehaviorPrivate() : animation(0), enabled(true) {}
- QDeclarativeMetaProperty property;
+ QDeclarativeProperty property;
QVariant currentValue;
QDeclarativeAbstractAnimation *animation;
bool enabled;
@@ -156,7 +157,7 @@ void QDeclarativeBehavior::write(const QVariant &value)
{
Q_D(QDeclarativeBehavior);
if (!d->animation || !d->enabled) {
- d->property.write(value, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
return;
}
@@ -171,15 +172,15 @@ void QDeclarativeBehavior::write(const QVariant &value)
action.toValue = value;
actions << action;
- QList<QDeclarativeMetaProperty> after;
+ QList<QDeclarativeProperty> after;
if (d->animation)
d->animation->transition(actions, after, QDeclarativeAbstractAnimation::Forward);
d->animation->qtAnimation()->start();
if (!after.contains(d->property))
- d->property.write(value, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(d->property, value, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
-void QDeclarativeBehavior::setTarget(const QDeclarativeMetaProperty &property)
+void QDeclarativeBehavior::setTarget(const QDeclarativeProperty &property)
{
Q_D(QDeclarativeBehavior);
d->property = property;
diff --git a/src/declarative/util/qdeclarativebehavior_p.h b/src/declarative/util/qdeclarativebehavior_p.h
index fbc19f8..a633b55 100644
--- a/src/declarative/util/qdeclarativebehavior_p.h
+++ b/src/declarative/util/qdeclarativebehavior_p.h
@@ -70,7 +70,7 @@ public:
QDeclarativeBehavior(QObject *parent=0);
~QDeclarativeBehavior();
- virtual void setTarget(const QDeclarativeMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
virtual void write(const QVariant &value);
QDeclarativeAbstractAnimation *animation();
diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp
index d75e98d..e95a03e 100644
--- a/src/declarative/util/qdeclarativebind.cpp
+++ b/src/declarative/util/qdeclarativebind.cpp
@@ -45,7 +45,7 @@
#include <qdeclarativeengine.h>
#include <qdeclarativecontext.h>
-#include <qdeclarativemetaproperty.h>
+#include <qdeclarativeproperty.h>
#include <QtCore/qfile.h>
#include <QtCore/qdebug.h>
@@ -196,7 +196,7 @@ void QDeclarativeBind::eval()
if (!d->obj || d->value.isNull || !d->when || !d->componentComplete)
return;
- QDeclarativeMetaProperty prop(d->obj, d->prop);
+ QDeclarativeProperty prop(d->obj, d->prop);
prop.write(d->value.value);
}
diff --git a/src/declarative/util/qdeclarativeconnection.cpp b/src/declarative/util/qdeclarativeconnection.cpp
index a7cfc79..e9ae74b 100644
--- a/src/declarative/util/qdeclarativeconnection.cpp
+++ b/src/declarative/util/qdeclarativeconnection.cpp
@@ -105,7 +105,7 @@ public:
\endqml
More generally, the Connection object can be a child of some other object than
- the sender of the signal, and the script is the default attribute:
+ the sender of the signal:
\qml
MouseArea {
@@ -226,8 +226,6 @@ void QDeclarativeConnection::componentComplete()
/*!
\qmlproperty script Connection::script
This property holds the JavaScript executed whenever the signal is sent.
-
- This is the default attribute of Connection.
*/
QDeclarativeScriptString QDeclarativeConnection::script() const
{
diff --git a/src/declarative/util/qdeclarativeeasefollow.cpp b/src/declarative/util/qdeclarativeeasefollow.cpp
index 0430a0b..232dc90 100644
--- a/src/declarative/util/qdeclarativeeasefollow.cpp
+++ b/src/declarative/util/qdeclarativeeasefollow.cpp
@@ -43,7 +43,7 @@
#include "qdeclarativeanimation_p_p.h"
-#include <qdeclarativemetaproperty.h>
+#include <qdeclarativeproperty.h>
#include <QtCore/qdebug.h>
@@ -77,7 +77,7 @@ public:
qreal trackVelocity;
- QDeclarativeMetaProperty target;
+ QDeclarativeProperty target;
int clockOffset;
int lastTick;
@@ -500,7 +500,7 @@ void QDeclarativeEaseFollow::setEnabled(bool enabled)
emit enabledChanged();
}
-void QDeclarativeEaseFollow::setTarget(const QDeclarativeMetaProperty &t)
+void QDeclarativeEaseFollow::setTarget(const QDeclarativeProperty &t)
{
Q_D(QDeclarativeEaseFollow);
d->target = t;
diff --git a/src/declarative/util/qdeclarativeeasefollow_p.h b/src/declarative/util/qdeclarativeeasefollow_p.h
index 6d14eb5..83d1eff 100644
--- a/src/declarative/util/qdeclarativeeasefollow_p.h
+++ b/src/declarative/util/qdeclarativeeasefollow_p.h
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QDeclarativeMetaProperty;
+class QDeclarativeProperty;
class QDeclarativeEaseFollowPrivate;
class Q_DECLARATIVE_EXPORT QDeclarativeEaseFollow : public QObject,
public QDeclarativePropertyValueSource
@@ -94,7 +94,7 @@ public:
qreal maximumEasingTime() const;
void setMaximumEasingTime(qreal);
- virtual void setTarget(const QDeclarativeMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
Q_SIGNALS:
void sourceChanged();
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 6c2e256..9c2b1e6 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -50,7 +50,7 @@
#include <qdeclarativebinding_p.h>
#include <qdeclarativecontext.h>
#include <qdeclarativeguard_p.h>
-#include <qdeclarativemetaproperty_p.h>
+#include <qdeclarativeproperty_p.h>
#include <QtCore/qdebug.h>
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass PropertyChanges QDeclarativePropertyChanges
- \since 4.7
+ \since 4.7
\brief The PropertyChanges element describes new property values for a state.
PropertyChanges provides a state change that modifies the properties of an item.
@@ -98,6 +98,33 @@ QT_BEGIN_NAMESPACE
}
\endqml
+ You can reset a property in a state change by assigning \c undefined. In the following
+ example we reset \c theText's width when we enter state1. This will give the text its
+ natural width (which is the whole string on one line).
+
+ \qml
+ import Qt 4.6
+
+ Rectangle {
+ width: 640
+ height: 480
+ Text {
+ id: theText
+ width: 50
+ wrap: true
+ text: "a text string that is longer than 50 pixels"
+ }
+
+ states: State {
+ name: "state1"
+ PropertyChanges {
+ target: theText
+ width: undefined
+ }
+ }
+ }
+ \endqml
+
Changes to an Item's parent or anchors should be done using the associated change elements
(ParentChange and AnchorChanges, respectively) rather than PropertyChanges.
@@ -126,19 +153,19 @@ public:
virtual QString typeName() const { return QLatin1String("ReplaceSignalHandler"); }
- QDeclarativeMetaProperty property;
+ QDeclarativeProperty property;
QDeclarativeExpression *expression;
QDeclarativeExpression *reverseExpression;
QDeclarativeExpression *rewindExpression;
QDeclarativeGuard<QDeclarativeExpression> ownedExpression;
virtual void execute() {
- ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, expression);
+ ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, expression);
}
virtual bool isReversable() { return true; }
virtual void reverse() {
- ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, reverseExpression);
+ ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, reverseExpression);
}
virtual void saveOriginals() {
@@ -147,10 +174,10 @@ public:
}
virtual void rewind() {
- ownedExpression = QDeclarativeMetaPropertyPrivate::setSignalExpression(property, rewindExpression);
+ ownedExpression = QDeclarativePropertyPrivate::setSignalExpression(property, rewindExpression);
}
virtual void saveCurrentValues() {
- rewindExpression = QDeclarativeMetaPropertyPrivate::signalExpression(property);
+ rewindExpression = QDeclarativePropertyPrivate::signalExpression(property);
}
virtual bool override(QDeclarativeActionEvent*other) {
@@ -185,7 +212,7 @@ public:
QList<QPair<QByteArray, QDeclarativeExpression *> > expressions;
QList<QDeclarativeReplaceSignalHandler*> signalReplacements;
- QDeclarativeMetaProperty property(const QByteArray &);
+ QDeclarativeProperty property(const QByteArray &);
};
void
@@ -269,8 +296,8 @@ void QDeclarativePropertyChangesPrivate::decode()
ds >> isScript;
ds >> data;
- QDeclarativeMetaProperty prop = property(name); //### better way to check for signal property?
- if (prop.type() & QDeclarativeMetaProperty::SignalProperty) {
+ QDeclarativeProperty prop = property(name); //### better way to check for signal property?
+ if (prop.type() & QDeclarativeProperty::SignalProperty) {
QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
QDeclarativeReplaceSignalHandler *handler = new QDeclarativeReplaceSignalHandler;
handler->property = prop;
@@ -344,17 +371,17 @@ void QDeclarativePropertyChanges::setRestoreEntryValues(bool v)
d->restore = v;
}
-QDeclarativeMetaProperty
+QDeclarativeProperty
QDeclarativePropertyChangesPrivate::property(const QByteArray &property)
{
Q_Q(QDeclarativePropertyChanges);
- QDeclarativeMetaProperty prop(object, QString::fromUtf8(property));
+ QDeclarativeProperty prop(object, QString::fromUtf8(property));
if (!prop.isValid()) {
qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property));
- return QDeclarativeMetaProperty();
- } else if (!(prop.type() & QDeclarativeMetaProperty::SignalProperty) && !prop.isWritable()) {
+ return QDeclarativeProperty();
+ } else if (!(prop.type() & QDeclarativeProperty::SignalProperty) && !prop.isWritable()) {
qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property));
- return QDeclarativeMetaProperty();
+ return QDeclarativeProperty();
}
return prop;
}
@@ -399,7 +426,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
for (int ii = 0; ii < d->expressions.count(); ++ii) {
QByteArray property = d->expressions.at(ii).first;
- QDeclarativeMetaProperty prop = d->property(property);
+ QDeclarativeProperty prop = d->property(property);
if (prop.isValid()) {
QDeclarativeAction a;
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index b26a7e2..012e6a0 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -63,7 +63,7 @@ public:
, mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01)
, modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {}
- QDeclarativeMetaProperty property;
+ QDeclarativeProperty property;
qreal currentValue;
qreal sourceValue;
qreal maxVelocity;
@@ -254,7 +254,7 @@ QDeclarativeSpringFollow::~QDeclarativeSpringFollow()
{
}
-void QDeclarativeSpringFollow::setTarget(const QDeclarativeMetaProperty &property)
+void QDeclarativeSpringFollow::setTarget(const QDeclarativeProperty &property)
{
Q_D(QDeclarativeSpringFollow);
d->property = property;
diff --git a/src/declarative/util/qdeclarativespringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h
index 63d38a4..2ac0d82 100644
--- a/src/declarative/util/qdeclarativespringfollow_p.h
+++ b/src/declarative/util/qdeclarativespringfollow_p.h
@@ -74,7 +74,7 @@ public:
QDeclarativeSpringFollow(QObject *parent=0);
~QDeclarativeSpringFollow();
- virtual void setTarget(const QDeclarativeMetaProperty &);
+ virtual void setTarget(const QDeclarativeProperty &);
qreal sourceValue() const;
void setSourceValue(qreal value);
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 3b06e33..1d70d33 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -334,7 +334,7 @@ void QDeclarativeState::cancel()
void QDeclarativeAction::deleteFromBinding()
{
if (fromBinding) {
- QDeclarativeMetaPropertyPrivate::setBinding(property, 0);
+ QDeclarativePropertyPrivate::setBinding(property, 0);
fromBinding->destroy();
fromBinding = 0;
}
@@ -388,7 +388,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
else if (action.event->isRewindable())
action.event->saveCurrentValues();
} else {
- action.fromBinding = QDeclarativeMetaPropertyPrivate::binding(action.property);
+ action.fromBinding = QDeclarativePropertyPrivate::binding(action.property);
for (jj = 0; jj < d->revertList.count(); ++jj) {
if (d->revertList.at(jj).property == action.property) {
@@ -437,7 +437,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
if (!found) {
QVariant cur = d->revertList.at(ii).property.read();
QDeclarativeAbstractBinding *delBinding =
- QDeclarativeMetaPropertyPrivate::setBinding(d->revertList.at(ii).property, 0);
+ QDeclarativePropertyPrivate::setBinding(d->revertList.at(ii).property, 0);
if (delBinding)
delBinding->destroy();
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index 4a62481..abdbec5 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -43,7 +43,7 @@
#define QDECLARATIVESTATE_H
#include <qdeclarative.h>
-#include <qdeclarativemetaproperty.h>
+#include <qdeclarativeproperty.h>
#include <QtCore/qobject.h>
QT_BEGIN_HEADER
@@ -65,7 +65,7 @@ public:
bool reverseEvent:1;
bool deletableToBinding:1;
- QDeclarativeMetaProperty property;
+ QDeclarativeProperty property;
QVariant fromValue;
QVariant toValue;
diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h
index 6b32f04..6f52219 100644
--- a/src/declarative/util/qdeclarativestate_p_p.h
+++ b/src/declarative/util/qdeclarativestate_p_p.h
@@ -58,7 +58,7 @@
#include "qdeclarativeanimation_p_p.h"
#include "qdeclarativetransitionmanager_p_p.h"
-#include <qdeclarativemetaproperty_p.h>
+#include <qdeclarativeproperty_p.h>
#include <qdeclarativeguard_p.h>
#include <private/qobject_p.h>
@@ -77,7 +77,7 @@ public:
event = a.event;
if (state == StartState) {
value = a.fromValue;
- binding = QDeclarativeMetaPropertyPrivate::binding(property);
+ binding = QDeclarativePropertyPrivate::binding(property);
reverseEvent = true;
} else {
value = a.toValue;
@@ -86,7 +86,7 @@ public:
}
}
- QDeclarativeMetaProperty property;
+ QDeclarativeProperty property;
QVariant value;
QDeclarativeAbstractBinding *binding;
QObject *specifiedObject;
@@ -139,7 +139,7 @@ public:
QDeclarativeTransitionManager transitionManager;
SimpleActionList revertList;
- QList<QDeclarativeMetaProperty> reverting;
+ QList<QDeclarativeProperty> reverting;
QString extends;
mutable bool inState;
QDeclarativeStateGroup *group;
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 6001a84..9df8658 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -80,7 +80,7 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q
//### for backwards direction, can we just restore original x, y, scale, rotation
Q_Q(QDeclarativeParentChange);
bool ok;
- const QTransform &transform = target->itemTransform(targetParent, &ok);
+ const QTransform &transform = target->parentItem()->itemTransform(targetParent, &ok);
if (transform.type() >= QTransform::TxShear || !ok) {
qmlInfo(q) << QDeclarativeParentChange::tr("Unable to preserve appearance under complex transform");
ok = false;
@@ -111,8 +111,9 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q
}
}
- qreal xt = transform.dx();
- qreal yt = transform.dy();
+ const QPointF &point = transform.map(QPointF(target->x(),target->y()));
+ qreal x = point.x();
+ qreal y = point.y();
if (ok && target->transformOrigin() != QDeclarativeItem::TopLeft) {
qreal tempxt = target->transformOriginPoint().x();
qreal tempyt = target->transformOriginPoint().y();
@@ -121,18 +122,18 @@ void QDeclarativeParentChangePrivate::doChange(QDeclarativeItem *targetParent, Q
t.rotate(rotation);
t.scale(scale, scale);
t.translate(tempxt, tempyt);
- QPointF offset = t.map(QPointF(0,0));
- xt += offset.x();
- yt += offset.y();
+ const QPointF &offset = t.map(QPointF(0,0));
+ x += offset.x();
+ y += offset.y();
}
target->setParentItem(targetParent);
if (ok) {
- //qDebug() << xt << yt << rotation << scale;
- target->setX(xt);
- target->setY(yt);
- target->setRotation(rotation);
- target->setScale(scale);
+ //qDebug() << x << y << rotation << scale;
+ target->setX(x);
+ target->setY(y);
+ target->setRotation(target->rotation() + rotation);
+ target->setScale(target->scale() * scale);
}
} else if (target) {
target->setParentItem(targetParent);
@@ -660,19 +661,19 @@ QList<QDeclarativeAction> QDeclarativeAnchorChanges::extraActions()
if (d->target) {
QDeclarativeAction a;
a.fromValue = d->fromX;
- a.property = QDeclarativeMetaProperty(d->target, QLatin1String("x"));
+ a.property = QDeclarativeProperty(d->target, QLatin1String("x"));
extra << a;
a.fromValue = d->fromY;
- a.property = QDeclarativeMetaProperty(d->target, QLatin1String("y"));
+ a.property = QDeclarativeProperty(d->target, QLatin1String("y"));
extra << a;
a.fromValue = d->fromWidth;
- a.property = QDeclarativeMetaProperty(d->target, QLatin1String("width"));
+ a.property = QDeclarativeProperty(d->target, QLatin1String("width"));
extra << a;
a.fromValue = d->fromHeight;
- a.property = QDeclarativeMetaProperty(d->target, QLatin1String("height"));
+ a.property = QDeclarativeProperty(d->target, QLatin1String("height"));
extra << a;
}
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index 3482814..ac07b10 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -148,7 +148,7 @@ void QDeclarativeTransition::setReversed(bool r)
}
void QDeclarativeTransition::prepare(QDeclarativeStateOperation::ActionList &actions,
- QList<QDeclarativeMetaProperty> &after,
+ QList<QDeclarativeProperty> &after,
QDeclarativeTransitionManager *endState)
{
Q_D(QDeclarativeTransition);
diff --git a/src/declarative/util/qdeclarativetransition_p.h b/src/declarative/util/qdeclarativetransition_p.h
index 96448b8..861111a 100644
--- a/src/declarative/util/qdeclarativetransition_p.h
+++ b/src/declarative/util/qdeclarativetransition_p.h
@@ -85,7 +85,7 @@ public:
QDeclarativeListProperty<QDeclarativeAbstractAnimation> animations();
void prepare(QDeclarativeStateOperation::ActionList &actions,
- QList<QDeclarativeMetaProperty> &after,
+ QList<QDeclarativeProperty> &after,
QDeclarativeTransitionManager *end);
void setReversed(bool r);
diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp
index 9fa1488..e1143fa 100644
--- a/src/declarative/util/qdeclarativetransitionmanager.cpp
+++ b/src/declarative/util/qdeclarativetransitionmanager.cpp
@@ -45,6 +45,7 @@
#include <qdeclarativebinding_p.h>
#include <qdeclarativeglobal_p.h>
+#include <qdeclarativeproperty_p.h>
QT_BEGIN_NAMESPACE
@@ -84,7 +85,7 @@ void QDeclarativeTransitionManager::complete()
d->applyBindings();
for (int ii = 0; ii < d->completeList.count(); ++ii) {
- const QDeclarativeMetaProperty &prop = d->completeList.at(ii).property;
+ const QDeclarativeProperty &prop = d->completeList.at(ii).property;
prop.write(d->completeList.at(ii).value);
}
@@ -98,7 +99,7 @@ void QDeclarativeTransitionManagerPrivate::applyBindings()
{
foreach(const QDeclarativeAction &action, bindingsList) {
if (action.toBinding) {
- QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding);
+ QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding);
} else if (action.event) {
if (action.reverseEvent)
action.event->reverse();
@@ -122,7 +123,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
if (action.toBinding)
d->bindingsList << action;
if (action.fromBinding)
- QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Disable current binding
+ QDeclarativePropertyPrivate::setBinding(action.property, 0); // Disable current binding
if (action.event && action.event->changesBindings()) { //### assume isReversable()?
d->bindingsList << action;
if (action.reverseEvent)
@@ -149,9 +150,9 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
for (int ii = 0; ii < applyList.size(); ++ii) {
const QDeclarativeAction &action = applyList.at(ii);
if (action.toBinding) {
- QDeclarativeMetaPropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
} else if (!action.event) {
- action.property.write(action.toValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
} else if (action.event->isReversable()) {
if (action.reverseEvent)
action.event->reverse();
@@ -166,7 +167,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
QDeclarativeAction *action = &applyList[ii];
if (action->event)
continue;
- const QDeclarativeMetaProperty &prop = action->property;
+ const QDeclarativeProperty &prop = action->property;
if (action->toBinding || !action->toValue.isValid()) { //### is this always right (used for exta actions)
action->toValue = prop.read();
}
@@ -190,14 +191,14 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> &
}
if (action.toBinding)
- QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition
+ QDeclarativePropertyPrivate::setBinding(action.property, 0); // Make sure this is disabled during the transition
- action.property.write(action.fromValue, QDeclarativeMetaProperty::BypassInterceptor | QDeclarativeMetaProperty::DontRemoveBinding);
+ QDeclarativePropertyPrivate::write(action.property, action.fromValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding);
}
}
if (transition) {
- QList<QDeclarativeMetaProperty> touched;
+ QList<QDeclarativeProperty> touched;
d->transition = transition;
d->transition->prepare(applyList, touched, this);
@@ -266,7 +267,7 @@ void QDeclarativeTransitionManager::cancel()
for(int i = 0; i < d->bindingsList.count(); ++i) {
QDeclarativeAction action = d->bindingsList[i];
if (action.toBinding && action.deletableToBinding) {
- QDeclarativeMetaPropertyPrivate::setBinding(action.property, 0);
+ QDeclarativePropertyPrivate::setBinding(action.property, 0);
action.toBinding->destroy();
action.toBinding = 0;
action.deletableToBinding = false;