PdfLinkModel QML Type
表示 PDF 文档中的链接。更多
Import Statement: | import QtQuick.Pdf |
属性
详细描述
PdfLinkModel 为指定的page 所包含的每个链接提供几何形状和目的地。
可用的模型角色有
常量 | 描述 |
---|---|
rectangle | 链接周围的边界矩形。 |
url | 如果链接是网络链接,则为该链接的 URL;否则为空 URL。 |
page | 如果链接是内部链接,则是链接应跳转到的页码;否则是-1 。 |
location | 如果该链接是内部链接,则表示该链接应跳转到的页面位置。 |
zoom | 如果链接是内部链接,则为目标页面的缩放级别。 |
通常情况下,它将与Repeater 一起使用,使链接可视化,并提供点击链接的功能:
Repeater { model: PdfLinkModel { document: root.document page: image.currentFrame } delegate: Rectangle { required property rect rectangle required property url url required property int page color: "transparent" border.color: "lightgrey" x: rectangle.x y: rectangle.y width: rectangle.width height: rectangle.height HoverHandler { cursorShape: Qt.PointingHandCursor } TapHandler { onTapped: { if (page >= 0) image.currentFrame = page else Qt.openUrlExternally(url) } } } }
注: 通用 PDF 浏览功能由PdfScrollablePageView
和PdfMultiPageView
提供。只有从头开始构建 PDF 视图组件时才需要 PdfLinkModel。
属性文档
document : PdfDocument |
该属性包含链接所在的 PDF 文档。
page : int |
该属性包含链接所在的页码。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.