summaryrefslogtreecommitdiffstats
path: root/src/pdf/quick/qquickpdfdocument.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-08-26 15:31:00 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-01-23 19:44:17 +0100
commitb6dd845ec4a6bfb6b620686681e20d38a2f24101 (patch)
treecafcf5b7c8f3185fb7fa5dfe07b38cd9b17a8cb7 /src/pdf/quick/qquickpdfdocument.cpp
parent32fb888f3c5b6d415d84895e3cab594de026d3dd (diff)
Add QPdfSearchModel, QML PdfSearchModel and PdfPageView
This enables searching a PDF for a text string and getting the boundaries of the areas where it is found. The boundaries are returned as polygons intended to be rendered with PathMultiline. PdfPageView is a QML component intended to be a drop-in viewer for use in applications that need the most common PDF viewing functionality. More advanced applications are free to use it as a starting point for customization. Task-number: QTBUG-77507 Task-number: QTBUG-77514 Change-Id: Id08ac30224e41b6cdfb9300cc4288d5750259f78 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/pdf/quick/qquickpdfdocument.cpp')
-rw-r--r--src/pdf/quick/qquickpdfdocument.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pdf/quick/qquickpdfdocument.cpp b/src/pdf/quick/qquickpdfdocument.cpp
index f0f40c227..73b3d4537 100644
--- a/src/pdf/quick/qquickpdfdocument.cpp
+++ b/src/pdf/quick/qquickpdfdocument.cpp
@@ -95,6 +95,41 @@ void QQuickPdfDocument::setSource(QUrl source)
}
/*!
+ \qmlproperty string Document::error
+
+ This property holds a translated string representation of the current
+ error, if any.
+
+ \sa status
+*/
+QString QQuickPdfDocument::error() const
+{
+ switch (m_doc.error()) {
+ case QPdfDocument::NoError:
+ return tr("no error");
+ break;
+ case QPdfDocument::UnknownError:
+ break;
+ case QPdfDocument::DataNotYetAvailableError:
+ return tr("data not yet available");
+ break;
+ case QPdfDocument::FileNotFoundError:
+ return tr("file not found");
+ break;
+ case QPdfDocument::InvalidFileFormatError:
+ return tr("invalid file format");
+ break;
+ case QPdfDocument::IncorrectPasswordError:
+ return tr("incorrect password");
+ break;
+ case QPdfDocument::UnsupportedSecuritySchemeError:
+ return tr("unsupported security scheme");
+ break;
+ }
+ return tr("unknown error");
+}
+
+/*!
\qmlproperty bool Document::password
This property holds the document password. If the passwordRequired()