summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2021-11-30 13:43:29 +0100
committerKai Köhne <kai.koehne@qt.io>2021-12-06 13:57:33 +0100
commit3399742b335b73156a0bc555fc3e820061070bd2 (patch)
treef4ab7fcf3033771155198b697345332069e17894 /src
parent87da8e4d32653fb8af35614c75948f5a050d2aa2 (diff)
Fix loading of LottieAnimation::source
QQmlFile seems to expect an absolute URL here. [ChangeLog] Fixed bug that prevented LottieAnimation from loading its source from a relative URL. Fixes: QTBUG-98794 Pick-to: 6.2 Change-Id: I58f01d36a4108a0fa9e4d863eb9185a514bf14b4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/lottieanimation.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/imports/lottieanimation.cpp b/src/imports/lottieanimation.cpp
index ba6574f..05f5c57 100644
--- a/src/imports/lottieanimation.cpp
+++ b/src/imports/lottieanimation.cpp
@@ -42,6 +42,7 @@
#include <QMetaObject>
#include <QLoggingCategory>
#include <QThread>
+#include <QQmlContext>
#include <QQmlFile>
#include <math.h>
@@ -598,7 +599,9 @@ void LottieAnimation::load()
{
setStatus(Loading);
- m_file.reset(new QQmlFile(qmlEngine(this), m_source));
+ const QQmlContext *context = qmlContext(this);
+ const QUrl loadUrl = context ? context->resolvedUrl(m_source) : m_source;
+ m_file.reset(new QQmlFile(qmlEngine(this), loadUrl));
if (m_file->isLoading())
m_file->connectFinished(this, SLOT(loadFinished()));
else