summaryrefslogtreecommitdiffstats
path: root/src/pdf
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-03-09 11:55:29 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2022-03-19 17:02:31 +0100
commitf23d112ce1c365f88a9fc70b68a7b543c099cc86 (patch)
treeec7cb10aa66e2698650ae40a1ae152eb523d717e /src/pdf
parenta980cc295e8e1a7876ab4083cce93151d00162aa (diff)
doc: Document the rest of the public API in QPdfDocument
Pick-to: 6.3 Task-number: QTBUG-81560 Change-Id: I145ff595e07c9e60139eb169832be86741698799 Reviewed-by: Luca Di Sera <luca.disera@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/qpdfdocument.cpp53
1 files changed, 49 insertions, 4 deletions
diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp
index b65504088..724bb02f0 100644
--- a/src/pdf/qpdfdocument.cpp
+++ b/src/pdf/qpdfdocument.cpp
@@ -482,6 +482,9 @@ QPdfDocument::~QPdfDocument()
{
}
+/*!
+ Loads the document contents from \a fileName.
+*/
QPdfDocument::DocumentError QPdfDocument::load(const QString &fileName)
{
qCDebug(qLcDoc) << "loading" << fileName;
@@ -500,6 +503,10 @@ QPdfDocument::DocumentError QPdfDocument::load(const QString &fileName)
return d->lastError;
}
+/*! \internal
+ Returns the filename of the document that has been opened,
+ or an empty string if no document is open.
+*/
QString QPdfDocument::fileName() const
{
const QFile *f = qobject_cast<QFile *>(d->device.data());
@@ -524,13 +531,18 @@ QString QPdfDocument::fileName() const
*/
/*!
- Returns the current status of the document.
+ \property QPdfDocument::status
+
+ This property holds the current status of the document.
*/
QPdfDocument::Status QPdfDocument::status() const
{
return d->status;
}
+/*!
+ Loads the document contents from \a device.
+*/
void QPdfDocument::load(QIODevice *device)
{
close();
@@ -540,6 +552,14 @@ void QPdfDocument::load(QIODevice *device)
d->load(device, /*transfer ownership*/false);
}
+/*!
+ \property QPdfDocument::password
+
+ This property holds the document password.
+
+ If the document is protected by a password, the user must provide it, and
+ the application must set this property. Otherwise, it's not needed.
+*/
void QPdfDocument::setPassword(const QString &password)
{
const QByteArray newPassword = password.toUtf8();
@@ -649,13 +669,33 @@ QVariant QPdfDocument::metaData(MetaDataField field) const
return QVariant();
}
+/*!
+ \enum QPdfDocument::DocumentError
+
+ This enum describes the error while attempting the last operation on the document.
+
+ \value NoError No error occurred.
+ \value UnknownError Unknown type of error.
+ \value DataNotYetAvailableError The document is still loading, it's too early to attempt the operation.
+ \value FileNotFoundError The file given to load() was not found.
+ \value InvalidFileFormatError The file given to load() is not a valid PDF file.
+ \value IncorrectPasswordError The password given to setPassword() is not correct for this file.
+ \value UnsupportedSecuritySchemeError QPdfDocument is not able to unlock this kind of PDF file.
+
+ \sa QPdfDocument::error()
+*/
+
+/*!
+ Returns the type of error if \l status is \c Error, or \c NoError if there
+ is no error.
+*/
QPdfDocument::DocumentError QPdfDocument::error() const
{
return d->lastError;
}
/*!
- Closes the document.
+ Closes the document.
*/
void QPdfDocument::close()
{
@@ -675,14 +715,19 @@ void QPdfDocument::close()
}
/*!
- Returns the amount of pages for the loaded document or \c 0 if
- no document is loaded.
+ \property QPdfDocument::pageCount
+
+ This property holds the number of pages in the loaded document or \c 0 if
+ no document is loaded.
*/
int QPdfDocument::pageCount() const
{
return d->pageCount;
}
+/*!
+ Returns the size of page \a page in points (1/72 of an inch).
+*/
QSizeF QPdfDocument::pageSize(int page) const
{
QSizeF result;