diff options
author | Kai Köhne <kai.koehne@qt.io> | 2021-11-30 13:43:29 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-12-06 14:13:23 +0000 |
commit | d234a3c723848b256998a506db3ecdf9d7bf75ca (patch) | |
tree | f703c1eeaa6722e3152064daaca9ac384b21bfe7 | |
parent | f11864a1fd9f49271c976b072d58d67ed3274b10 (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
Change-Id: I58f01d36a4108a0fa9e4d863eb9185a514bf14b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3399742b335b73156a0bc555fc3e820061070bd2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/imports/lottieanimation.cpp | 5 |
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 |