The QPdfLinkModel class holds the geometry and the destination for each link that the specified page contains. More...
| Header: | #include <QPdfLinkModel> |
| Since: | Qt 6.6 |
| Inherits: | QAbstractListModel |
| enum class | Role { Link, Rectangle, Url, Page, Location, Zoom } |
| QPdfLinkModel(QObject *parent = nullptr) | |
| virtual | ~QPdfLinkModel() override |
| QPdfDocument * | document() const |
| QPdfLink | linkAt(QPointF point) const |
| int | page() const |
| virtual QVariant | data(const QModelIndex &index, int role) const override |
| virtual int | rowCount(const QModelIndex &parent) const override |
| void | setDocument(QPdfDocument *document) |
| void | setPage(int page) |
| void | documentChanged() |
| void | pageChanged(int page) |
This is used in PDF viewers to implement the hyperlink mechanism.
| Constant | Value | Description |
|---|---|---|
QPdfLinkModel::Role::Link |
Qt::UserRole |
A QPdfLink object. |
QPdfLinkModel::Role::Rectangle |
257 |
Bounding rectangle around the link. |
QPdfLinkModel::Role::Url |
258 |
If the link is a web link, the URL for that; otherwise an empty URL. |
QPdfLinkModel::Role::Page |
259 |
If the link is an internal link, the page number to which the link should jump; otherwise -1. |
QPdfLinkModel::Role::Location |
260 |
If the link is an internal link, the location on the page to which the link should jump. |
QPdfLinkModel::Role::Zoom |
261 |
If the link is an internal link, the suggested zoom level on the destination page. |
This property holds the document to load links from.
Access functions:
| QPdfDocument * | document() const |
| void | setDocument(QPdfDocument *document) |
Notifier signal:
| void | documentChanged() |
This property holds the page to load links from.
Access functions:
| int | page() const |
| void | setPage(int page) |
Notifier signal:
| void | pageChanged(int page) |
[explicit] QPdfLinkModel::QPdfLinkModel(QObject *parent = nullptr)Constructs a new link model with parent object parent.
[override virtual noexcept] QPdfLinkModel::~QPdfLinkModel()Destroys the model.
[override virtual] QVariant QPdfLinkModel::data(const
QModelIndex &index, int role) constReimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.
Returns a valid link if found under the point (given in units of points, 1/72 of an inch), or an invalid link if it is not found. In other words, this function is useful for picking, to handle mouse click or hover.
[override virtual] int QPdfLinkModel::rowCount(const QModelIndex &parent) constReimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.