diff options
author | Michal Klocek <michal.klocek@qt.io> | 2023-02-24 13:08:21 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2023-03-02 11:12:36 +0000 |
commit | efbb12954cf6e581b6b29bed2fa2bb26e1cfab71 (patch) | |
tree | 77dbe7977073283b5a502b5576f915058e968aa1 /src/pdfquick | |
parent | 1d60666419773ee91638c5666650a4fb62f22468 (diff) | |
download | qtwebengine-efbb12954cf6e581b6b29bed2fa2bb26e1cfab71.tar.gz |
Fix not working password test for QPdfQuick
In qml url can have different schemas like 'qrc'
'file' 'assets'. Make correct conversion so
file can be loaded.
Note check isLocalFile() is not true for qrc scheme.
Fixes: QTBUG-106072
Pick-to: 6.5.0 6.5 6.4
Change-Id: I4dcc969e4c6d9b3f58ea5d81d20d8e81b55edfde
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/pdfquick')
-rw-r--r-- | src/pdfquick/qquickpdfdocument.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pdfquick/qquickpdfdocument.cpp b/src/pdfquick/qquickpdfdocument.cpp index 368725a8e..5564a7474 100644 --- a/src/pdfquick/qquickpdfdocument.cpp +++ b/src/pdfquick/qquickpdfdocument.cpp @@ -8,6 +8,7 @@ #include <QtQml/qqmlcontext.h> #include <QtQml/qqmlengine.h> #include <QtQuick/qquickitem.h> +#include <QtQml/qqmlfile.h> QT_BEGIN_NAMESPACE @@ -41,9 +42,9 @@ void QQuickPdfDocument::classBegin() { m_doc = static_cast<QPdfDocument *>(qmlExtendedObject(this)); Q_ASSERT(m_doc); - connect(m_doc, &QPdfDocument::passwordChanged, this, [this]() { - if (resolvedSource().isValid() && resolvedSource().isLocalFile()) - m_doc->load(resolvedSource().path()); + connect(m_doc, &QPdfDocument::passwordChanged, this, [this]() -> void { + if (resolvedSource().isValid()) + m_doc->load(QQmlFile::urlToLocalFileOrQrc(resolvedSource())); }); connect(m_doc, &QPdfDocument::statusChanged, this, [this] (QPdfDocument::Status status) { emit errorChanged(); |