summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-09 10:38:13 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-10 00:12:48 (GMT)
commit932f667eaad727854f6bb48d797874455ed13231 (patch)
tree30fb3381e843400128a5f796184a17547b500068
parent25bed69b3c643943dac195227d3f3fadc441516c (diff)
downloadQt-932f667eaad727854f6bb48d797874455ed13231.zip
Qt-932f667eaad727854f6bb48d797874455ed13231.tar.gz
Qt-932f667eaad727854f6bb48d797874455ed13231.tar.bz2
Support URL resolution from within script blocks
-rw-r--r--src/declarative/qml/qmlbinding.cpp4
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp25
2 files changed, 25 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index 39851ff..f9c9561 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -126,10 +126,6 @@ void QmlBinding::update()
value = con(value.toString());
}
- if (d->property.propertyType() == QVariant::Url &&
- (value.type() == QVariant::String || value.type() == QVariant::ByteArray) && !value.isNull())
- value.setValue(context()->resolvedUrl(QUrl(value.toString())));
-
if (d->property.propertyType() == QVariant::Vector3D &&
value.type() == QVariant::String) {
value = qVariantFromValue(QmlStringConverters::vector3DFromString(value.toString()));
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index fdba79e..affb93b 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -874,6 +874,31 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
}
break;
+ case QVariant::Url:
+ {
+ QUrl u;
+ if (vt == QVariant::ByteArray) {
+ u = QUrl(QLatin1String(value.toByteArray()));
+ found = true;
+ } else if (QVariant::String) {
+ u = QUrl(value.toString());
+ found = true;
+ }
+
+ if (context && u.isRelative())
+ u = context->baseUrl().resolved(u);
+
+ if (found) {
+ void *a[1];
+ a[0] = &u;
+ QMetaObject::metacall(object,
+ QMetaObject::WriteProperty,
+ coreIdx, a);
+ }
+
+ }
+ break;
+
default:
{