diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-04-20 09:27:01 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-20 02:26:23 +0200 |
commit | 360f0d00088cc84791e7a197b20a325bfdac9eb3 (patch) | |
tree | 88b38436920dca8ec5486c1cdc852dff7f8b0fd7 /src/qml/qml/qqmlproperty.cpp | |
parent | b93e463465f5c4241d2dae9aaaa198684e1199fb (diff) |
Use QUrl constructor directly.
setEncodedUrl is deprecated, and no longer required as the new QUrl
makes this behavior default. This is a partial revert of
3aa53b8bc383ebcdf8dc922b2670170ec012949f.
Change-Id: I14f29cbe2a2e2cd9c41f7afc92b1cb66b53996bb
Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 075c1f6c4f..002986157f 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1084,22 +1084,6 @@ QVariant QQmlPropertyPrivate::readValueProperty() } } -static QUrl urlFromUserString(const QByteArray &data) -{ - QUrl u; - if (!data.isEmpty()) - { - // Preserve any valid percent-encoded octets supplied by the source - u.setEncodedUrl(data, QUrl::TolerantMode); - } - return u; -} - -static QUrl urlFromUserString(const QString &data) -{ - return urlFromUserString(data.toUtf8()); -} - // helper function to allow assignment / binding to QList<QUrl> properties. static QVariant resolvedUrlSequence(const QVariant &value, QQmlContextData *context) { @@ -1107,19 +1091,19 @@ static QVariant resolvedUrlSequence(const QVariant &value, QQmlContextData *cont if (value.userType() == qMetaTypeId<QUrl>()) { urls.append(value.toUrl()); } else if (value.userType() == qMetaTypeId<QString>()) { - urls.append(urlFromUserString(value.toString())); + urls.append(QUrl(value.toString())); } else if (value.userType() == qMetaTypeId<QByteArray>()) { - urls.append(urlFromUserString(value.toByteArray())); + urls.append(QUrl(QString::fromUtf8(value.toByteArray()))); } else if (value.userType() == qMetaTypeId<QList<QUrl> >()) { urls = value.value<QList<QUrl> >(); } else if (value.userType() == qMetaTypeId<QStringList>()) { QStringList urlStrings = value.value<QStringList>(); for (int i = 0; i < urlStrings.size(); ++i) - urls.append(urlFromUserString(urlStrings.at(i))); + urls.append(QUrl(urlStrings.at(i))); } else if (value.userType() == qMetaTypeId<QList<QString> >()) { QList<QString> urlStrings = value.value<QList<QString> >(); for (int i = 0; i < urlStrings.size(); ++i) - urls.append(urlFromUserString(urlStrings.at(i))); + urls.append(QUrl(urlStrings.at(i))); } // note: QList<QByteArray> is not currently supported. QList<QUrl> resolvedUrls; @@ -1259,10 +1243,10 @@ bool QQmlPropertyPrivate::write(QObject *object, u = value.toUrl(); found = true; } else if (variantType == QVariant::ByteArray) { - u = urlFromUserString(value.toByteArray()); + u = QUrl(QString::fromUtf8(value.toByteArray())); found = true; } else if (variantType == QVariant::String) { - u = urlFromUserString(value.toString()); + u = QUrl(value.toString()); found = true; } |