QPdfLinkModel Class

The QPdfLinkModel class holds the geometry and the destination for each link that the specified page contains. 更多...

头: #include <QPdfLinkModel>
Since: Qt 6.6
继承: QAbstractListModel

公共类型

enum class 角色 { 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.

成员类型文档编制

enum class QPdfLinkModel:: 角色

常量 描述
QPdfLinkModel::Role::Link Qt::UserRole A QPdfLink 对象。
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.

特性文档编制

document : QPdfDocument *

This property holds the document to load links from.

访问函数:

QPdfDocument * document () const
void setDocument (QPdfDocument * document )

通知程序信号:

void documentChanged ()

page : int

This property holds the page to load links from.

访问函数:

int page () const
void setPage (int page )

通知程序信号:

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 ) const

重实现: QAbstractItemModel::data(const QModelIndex &index, int role) const .

QPdfLink QPdfLinkModel:: linkAt ( QPointF point ) const

返回 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 ) const

重实现: QAbstractItemModel::rowCount(const QModelIndex &parent) const .