Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickpdfdocument_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKPDFDOCUMENT_P_H
5#define QQUICKPDFDOCUMENT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtPdfQuick/private/qtpdfquickglobal_p.h>
19#include <QtPdf/QPdfDocument>
20
21#include <QtQml/QQmlEngine>
22#include <QtQml/QQmlParserStatus>
23#include <QtCore/QDateTime>
24#include <QtCore/QUrl>
25
27
28class QPdfFile;
29
31{
34
35 Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged FINAL)
36 Q_PROPERTY(qreal maxPageWidth READ maxPageWidth NOTIFY metaDataChanged FINAL)
37 Q_PROPERTY(qreal maxPageHeight READ maxPageHeight NOTIFY metaDataChanged FINAL)
38 Q_PROPERTY(QString error READ error NOTIFY errorChanged FINAL)
39
40 Q_PROPERTY(QString title READ title NOTIFY metaDataChanged FINAL)
41 Q_PROPERTY(QString subject READ subject NOTIFY metaDataChanged FINAL)
42 Q_PROPERTY(QString author READ author NOTIFY metaDataChanged FINAL)
43 Q_PROPERTY(QString keywords READ keywords NOTIFY metaDataChanged FINAL)
44 Q_PROPERTY(QString producer READ producer NOTIFY metaDataChanged FINAL)
45 Q_PROPERTY(QString creator READ creator NOTIFY metaDataChanged FINAL)
46 Q_PROPERTY(QDateTime creationDate READ creationDate NOTIFY metaDataChanged FINAL)
47 Q_PROPERTY(QDateTime modificationDate READ modificationDate NOTIFY metaDataChanged FINAL)
48 QML_NAMED_ELEMENT(PdfDocument)
51
52public:
53 explicit QQuickPdfDocument(QObject *parent = nullptr);
54 ~QQuickPdfDocument() override;
55
56 void classBegin() override;
57 void componentComplete() override {}
58
59 QUrl source() const { return m_source; }
60 void setSource(QUrl source);
61 QUrl resolvedSource() const { return m_resolvedSource; }
62
63 QString error() const;
64
65 QString title() { return m_doc->metaData(QPdfDocument::MetaDataField::Title).toString(); }
66 QString author() { return m_doc->metaData(QPdfDocument::MetaDataField::Author).toString(); }
67 QString subject() { return m_doc->metaData(QPdfDocument::MetaDataField::Subject).toString(); }
68 QString keywords() { return m_doc->metaData(QPdfDocument::MetaDataField::Keywords).toString(); }
69 QString producer() { return m_doc->metaData(QPdfDocument::MetaDataField::Producer).toString(); }
70 QString creator() { return m_doc->metaData(QPdfDocument::MetaDataField::Creator).toString(); }
71 QDateTime creationDate() { return m_doc->metaData(QPdfDocument::MetaDataField::CreationDate).toDateTime(); }
73
74 qreal maxPageWidth() const;
75 qreal maxPageHeight() const;
76
81
82private:
83 QPdfDocument *document() const;
84 QPdfFile *carrierFile();
85 void updateMaxPageSize() const;
86
87private:
88 QUrl m_source;
89 QUrl m_resolvedSource;
90 QPdfDocument *m_doc = nullptr;
91 QPdfFile *m_carrierFile = nullptr;
92 mutable QSizeF m_maxPageWidthHeight;
93
95 friend class QQuickPdfLinkModel;
96 friend class QQuickPdfPageImage;
98 friend class QQuickPdfSelection;
99
100 Q_DISABLE_COPY(QQuickPdfDocument)
101};
102
104
105#endif // QQUICKPDFDOCUMENT_P_H
\inmodule QtCore\reentrant
Definition qdatetime.h:283
\inmodule QtCore
Definition qobject.h:103
The QPdfDocument class loads a PDF document and renders pages from it.
The QQmlParserStatus class provides updates on the QML parser state.
QUrl resolvedSource() const
\inmodule QtCore
Definition qsize.h:208
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
static const struct @480 keywords[]
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLsizei GLsizei GLchar * source
#define QML_EXTENDED(EXTENDED_TYPE)
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INTERFACES(x)
#define Q_SIGNALS
#define Q_PDFQUICK_EXPORT
double qreal
Definition qtypes.h:187
#define explicit
QString title
[35]
QItemEditorCreatorBase * creator