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/particles | |
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/particles')
-rw-r--r-- | src/particles/qquickimageparticle.cpp | 19 | ||||
-rw-r--r-- | src/particles/qquickmaskextruder.cpp | 6 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index 05c21ecf56..29eb9ecdf2 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -1169,22 +1169,33 @@ bool QQuickImageParticle::loadingSomething() void QQuickImageParticle::mainThreadFetchImageData() { + const QQmlContext *context = nullptr; + QQmlEngine *engine = nullptr; + const auto loadPix = [&](ImageData *image) { + if (!engine) { + context = qmlContext(this); + engine = context->engine(); + } + image->pix.load(engine, context->resolvedUrl(image->source)); + }; + + if (m_image) {//ImageData created on setSource m_image->pix.clear(this); - m_image->pix.load(qmlEngine(this), m_image->source); + loadPix(m_image.get()); } if (m_spriteEngine) m_spriteEngine->startAssemblingImage(); if (m_colorTable) - m_colorTable->pix.load(qmlEngine(this), m_colorTable->source); + loadPix(m_colorTable.get()); if (m_sizeTable) - m_sizeTable->pix.load(qmlEngine(this), m_sizeTable->source); + loadPix(m_sizeTable.get()); if (m_opacityTable) - m_opacityTable->pix.load(qmlEngine(this), m_opacityTable->source); + loadPix(m_opacityTable.get()); m_startedImageLoading = 2; } diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp index 2ce3650743..61f9092f0a 100644 --- a/src/particles/qquickmaskextruder.cpp +++ b/src/particles/qquickmaskextruder.cpp @@ -40,9 +40,12 @@ #include "qquickmaskextruder_p.h" #include <QtQml/qqml.h> #include <QtQml/qqmlinfo.h> +#include <QtQml/qqmlcontext.h> + #include <QImage> #include <QDebug> #include <QRandomGenerator> + QT_BEGIN_NAMESPACE /*! \qmltype MaskShape @@ -85,7 +88,8 @@ void QQuickMaskExtruder::startMaskLoading() m_pix.clear(this); if (m_source.isEmpty()) return; - m_pix.load(qmlEngine(this), m_source); + const QQmlContext *context = qmlContext(this); + m_pix.load(context->engine(), context->resolvedUrl(m_source)); if (m_pix.isLoading()) m_pix.connectFinished(this, SLOT(finishMaskLoading())); else |