diff options
Diffstat (limited to 'src/pdfquick')
-rw-r--r-- | src/pdfquick/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/pdfquick/qquickpdfdocument.cpp | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/pdfquick/CMakeLists.txt b/src/pdfquick/CMakeLists.txt index 112321015..560817446 100644 --- a/src/pdfquick/CMakeLists.txt +++ b/src/pdfquick/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Qml Quick) set(qml_files diff --git a/src/pdfquick/qquickpdfdocument.cpp b/src/pdfquick/qquickpdfdocument.cpp index 5564a7474..492c320d6 100644 --- a/src/pdfquick/qquickpdfdocument.cpp +++ b/src/pdfquick/qquickpdfdocument.cpp @@ -74,10 +74,8 @@ void QQuickPdfDocument::setSource(QUrl source) emit sourceChanged(); const QQmlContext *context = qmlContext(this); m_resolvedSource = context ? context->resolvedUrl(source) : source; - if (source.scheme() == QLatin1String("qrc")) - m_doc->load(QLatin1Char(':') + m_resolvedSource.path()); - else - m_doc->load(m_resolvedSource.toLocalFile()); + if (m_resolvedSource.isValid()) + m_doc->load(QQmlFile::urlToLocalFileOrQrc(m_resolvedSource)); } /*! |