aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickanimatedimage.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-06-15 17:53:16 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-06-22 18:37:52 +0200
commit0a1e4cc7ec7548f6273befff9cdddb0bc7a58961 (patch)
treebf8b7ae725ac332fa59bd9058cc479018aca147d /src/quick/items/qquickanimatedimage.cpp
parent4e266103ad8b75d71fb176a2f774faf71997123d (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/quick/items/qquickanimatedimage.cpp')
-rw-r--r--src/quick/items/qquickanimatedimage.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp
index eb3385c8f8..9de48cbf5f 100644
--- a/src/quick/items/qquickanimatedimage.cpp
+++ b/src/quick/items/qquickanimatedimage.cpp
@@ -339,8 +339,10 @@ void QQuickAnimatedImage::load()
const qreal targetDevicePixelRatio = (window() ? window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio());
d->devicePixelRatio = 1.0;
- QUrl loadUrl = d->url;
- resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
+ const auto context = qmlContext(this);
+ QUrl loadUrl = context ? context->resolvedUrl(d->url) : d->url;
+ const QUrl resolvedUrl = loadUrl;
+ resolve2xLocalFile(resolvedUrl, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
QString lf = QQmlFile::urlToLocalFileOrQrc(loadUrl);
if (!lf.isEmpty()) {
@@ -393,7 +395,9 @@ void QQuickAnimatedImage::movieRequestFinished()
#endif
if (!d->movie || !d->movie->isValid()) {
- qmlWarning(this) << "Error Reading Animated Image File " << d->url.toString();
+ const QQmlContext *context = qmlContext(this);
+ qmlWarning(this) << "Error Reading Animated Image File "
+ << (context ? context->resolvedUrl(d->url) : d->url).toString();
d->setMovie(nullptr);
d->setImage(QImage());
if (d->progress != 0) {