diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-15 17:53:16 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-22 18:37:52 +0200 |
commit | 0a1e4cc7ec7548f6273befff9cdddb0bc7a58961 (patch) | |
tree | bf8b7ae725ac332fa59bd9058cc479018aca147d /src/qml/qml/qqmlobjectcreator.cpp | |
parent | 4e266103ad8b75d71fb176a2f774faf71997123d (diff) |
Do not resolve URLs when assigning them to a property
We don't know in advance if a URL is part of the source code and should
be relative to the current element, or if it is part of the application
data and should not be touched.
[ChangeLog][QtQml][Important Behavior Changes] URLs are not resolved or
intercepted anymore when assigning them to a "url" property. Instead
they are resolved and possibly intercepted when used to access an actual
resource.
Fixes: QTBUG-76879
Change-Id: Iaa2385aff2c13aa71a12e57385d9afb5dc60a073
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 61d287fc88..19ec8d95de 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -452,10 +452,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const case QMetaType::QUrl: { assertType(QV4::CompiledData::Binding::Type_String); const QString string = compilationUnit->bindingValueAsString(binding); - QUrl value = string.isEmpty() ? QUrl() - : compilationUnit->finalUrl().resolved(QUrl(string)); - // Apply URL interceptor - value = engine->interceptUrl(value, QQmlAbstractUrlInterceptor::UrlString); + QUrl value(string); property->writeProperty(_qobject, &value, propertyWriteFlags); } break; @@ -646,11 +643,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const break; } else if (property->propType() == qMetaTypeId<QList<QUrl> >()) { assertType(QV4::CompiledData::Binding::Type_String); - QString urlString = compilationUnit->bindingValueAsString(binding); - QUrl u = urlString.isEmpty() ? QUrl() - : compilationUnit->finalUrl().resolved(QUrl(urlString)); - QList<QUrl> value; - value.append(u); + QList<QUrl> value { QUrl(compilationUnit->bindingValueAsString(binding)) }; property->writeProperty(_qobject, &value, propertyWriteFlags); break; } else if (property->propType() == qMetaTypeId<QList<QString> >()) { |