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
qpdflinkmodel.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QPDFLINKMODEL_H
5#define QPDFLINKMODEL_H
6
7#include <QtPdf/qtpdfglobal.h>
8#include <QtPdf/qpdfdocument.h>
9#include <QtPdf/qpdflink.h>
10
11#include <QtCore/QAbstractListModel>
12
13#include <memory>
14
16
18
19class Q_PDF_EXPORT QPdfLinkModel : public QAbstractListModel
20{
22 Q_PROPERTY(QPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged)
23 Q_PROPERTY(int page READ page WRITE setPage NOTIFY pageChanged)
24
25public:
26 enum class Role {
27 Link = Qt::UserRole,
28 Rectangle,
29 Url,
30 Page,
31 Location,
32 Zoom,
33 NRoles
34 };
35 Q_ENUM(Role)
36 explicit QPdfLinkModel(QObject *parent = nullptr);
37 ~QPdfLinkModel() override;
38
39 QPdfDocument *document() const;
40
41 QHash<int, QByteArray> roleNames() const override;
42 int rowCount(const QModelIndex &parent) const override;
43 QVariant data(const QModelIndex &index, int role) const override;
44
45 int page() const;
46
47 QPdfLink linkAt(QPointF point) const;
48
49public Q_SLOTS:
50 void setDocument(QPdfDocument *document);
51 void setPage(int page);
52
55 void pageChanged(int page);
56
57private Q_SLOTS:
58 void onStatusChanged(QPdfDocument::Status status);
59
60private:
61 Q_DECLARE_PRIVATE(QPdfLinkModel)
62 const std::unique_ptr<QPdfLinkModelPrivate> d_ptr;
63};
64
66
67#endif // QPDFLINKMODEL_H
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:103
The QPdfDocument class loads a PDF document and renders pages from it.
Status
This enum describes the current status of the document.
The QPdfLinkModel class holds the geometry and the destination for each link that the specified \l pa...
void pageChanged(int page)
Role
\value Link A QPdfLink object.
void documentChanged()
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
@ UserRole
GLuint index
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
QByteArray page
[45]