summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-04-09 03:42:22 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-04-09 03:44:56 (GMT)
commitda56d7c25ce344128d827cfa2ed26f9eea437e4d (patch)
tree863bb2873aa12213b38c824940f8f58dc776d250 /src
parent6e8342957d08d783c211fe0896c326aa44a13ee2 (diff)
downloadQt-da56d7c25ce344128d827cfa2ed26f9eea437e4d.zip
Qt-da56d7c25ce344128d827cfa2ed26f9eea437e4d.tar.gz
Qt-da56d7c25ce344128d827cfa2ed26f9eea437e4d.tar.bz2
Fix url resolution in PropertyChanges.
Make sure bindings in PropertyChanges resolve urls correctly. Also refactor the code so that PropertyChanges will always use the standard url resolution support provided by QDeclarativeProperty. Task-number: QTBUG-9571
Diffstat (limited to 'src')
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp13
-rw-r--r--src/declarative/util/qdeclarativestate.cpp12
-rw-r--r--src/declarative/util/qdeclarativestate_p.h2
3 files changed, 18 insertions, 9 deletions
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index ecbd71e..9c3ee9f 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -377,7 +377,7 @@ QDeclarativeProperty
QDeclarativePropertyChangesPrivate::property(const QByteArray &property)
{
Q_Q(QDeclarativePropertyChanges);
- QDeclarativeProperty prop(object, QString::fromUtf8(property));
+ QDeclarativeProperty prop(object, QString::fromUtf8(property), qmlContext(q));
if (!prop.isValid()) {
qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property));
return QDeclarativeProperty();
@@ -400,16 +400,11 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
QByteArray property = d->properties.at(ii).first;
- QDeclarativeAction a(d->object, QString::fromLatin1(property),
- d->properties.at(ii).second);
+ QDeclarativeAction a(d->object, QString::fromUtf8(property),
+ qmlContext(this), d->properties.at(ii).second);
if (a.property.isValid()) {
a.restore = restoreEntryValues();
-
- if (a.property.propertyType() == QVariant::Url &&
- (a.toValue.userType() == QVariant::String || a.toValue.userType() == QVariant::ByteArray) && !a.toValue.isNull())
- a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString())));
-
list << a;
}
}
@@ -436,7 +431,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions()
a.property = prop;
a.fromValue = a.property.read();
a.specifiedObject = d->object;
- a.specifiedProperty = QString::fromLatin1(property);
+ a.specifiedProperty = QString::fromUtf8(property);
if (d->isExplicit) {
a.toValue = d->expressions.at(ii).second->value();
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index e4c968e..78813fa 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -74,6 +74,18 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN
fromValue = property.read();
}
+QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName,
+ QDeclarativeContext *context, const QVariant &value)
+: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
+ property(target, propertyName, context), toValue(value),
+ fromBinding(0), toBinding(0), event(0),
+ specifiedObject(target), specifiedProperty(propertyName)
+{
+ if (property.isValid())
+ fromValue = property.read();
+}
+
+
QDeclarativeActionEvent::~QDeclarativeActionEvent()
{
}
diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h
index ee2b7e8..472897e 100644
--- a/src/declarative/util/qdeclarativestate_p.h
+++ b/src/declarative/util/qdeclarativestate_p.h
@@ -61,6 +61,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAction
public:
QDeclarativeAction();
QDeclarativeAction(QObject *, const QString &, const QVariant &);
+ QDeclarativeAction(QObject *, const QString &,
+ QDeclarativeContext *, const QVariant &);
bool restore:1;
bool actionDone:1;