From 2795a73158280ddce4eec57c643d367bb402a03d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 15 Sep 2009 10:57:13 +0200 Subject: 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 --- src/declarative/qml/qmlmetaproperty.cpp | 8 ++++++-- 1 file 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) { -- cgit v0.12