summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-09-15 08:57:13 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-09-15 08:57:13 (GMT)
commit2795a73158280ddce4eec57c643d367bb402a03d (patch)
tree8bffe4366e0118aaaf21abc9940a0115edcb27f4
parentb43b430b0668d145e31fd0445ed9d272270a576c (diff)
downloadQt-2795a73158280ddce4eec57c643d367bb402a03d.zip
Qt-2795a73158280ddce4eec57c643d367bb402a03d.tar.gz
Qt-2795a73158280ddce4eec57c643d367bb402a03d.tar.bz2
Ensure that relative urls are made absolute in all cases
Always resolve make urls absolute in QmlMetaProperty::write, even when the type of the variant passed in is already of type QUrl. Reviewed-by: Aaron Kennedy
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index b305619..792b098 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -721,7 +721,8 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
int vt = value.userType();
int category = propertyCategory();
- if (vt == t) {
+ if (vt == t
+ && t != QVariant::Url) { // always resolve relative urls
void *a[1];
a[0] = (void *)value.constData();
@@ -877,7 +878,10 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value)
case QVariant::Url:
{
QUrl u;
- if (vt == QVariant::ByteArray) {
+ if (vt == QVariant::Url) {
+ u = value.toUrl();
+ found = true;
+ } else if (vt == QVariant::ByteArray) {
u = QUrl(QLatin1String(value.toByteArray()));
found = true;
} else if (vt == QVariant::String) {