summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-02-24 13:08:21 +0100
committerMichal Klocek <michal.klocek@qt.io>2023-03-08 16:58:40 +0100
commitabd2b84ec2b5e6c8f824baeb706bb9de0043cdf5 (patch)
tree334983bd727ab0fda5cb4fa35289828a437fa459
parent3b7dda330a0e7c7803ce1fe1059ee36f8ae0d786 (diff)
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 Change-Id: I4dcc969e4c6d9b3f58ea5d81d20d8e81b55edfde Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit efbb12954cf6e581b6b29bed2fa2bb26e1cfab71)
-rw-r--r--src/pdfquick/qquickpdfdocument.cpp7
-rw-r--r--tests/auto/pdfquick/multipageview/BLACKLIST3
2 files changed, 4 insertions, 6 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();
diff --git a/tests/auto/pdfquick/multipageview/BLACKLIST b/tests/auto/pdfquick/multipageview/BLACKLIST
deleted file mode 100644
index b608bef1c..000000000
--- a/tests/auto/pdfquick/multipageview/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-# QTBUG-106072
-[password]
-windows