PdfLinkModel QML Type

A representation of links within a PDF document. More...

Import Statement: import QtQuick.Pdf 5.15
Since: Qt 5.15

Properties

Detailed Description

PdfLinkModel provides the geometry and the destination for each link that the specified page contains.

The available model roles are:

ConstantDescription
rectBounding rectangle around the link.
urlIf the link is a web link, the URL for that; otherwise an empty URL.
pageIf the link is an internal link, the page number to which the link should jump; otherwise -1.
locationIf the link is an internal link, the location on the page to which the link should jump.
zoomIf the link is an internal link, the intended zoom level on the destination page.

Normally it will be used with Repeater to visualize the links and provide the ability to click them:

Repeater {
    model: PdfLinkModel {
        document: root.document
        page: image.currentFrame
    }
    delegate: Rectangle {
        color: "transparent"
        border.color: "lightgrey"
        x: rect.x
        y: rect.y
        width: rect.width
        height: rect.height
        HoverHandler { cursorShape: Qt.PointingHandCursor }
        TapHandler {
            onTapped: {
                if (page >= 0)
                    image.currentFrame = page
                else
                    Qt.openUrlExternally(url)
            }
        }
    }
}

Note: General-purpose PDF viewing capabilities are provided by PdfScrollablePageView and PdfMultiPageView. PdfLinkModel is only needed when building PDF view components from scratch.

Property Documentation

document : PdfDocument

This property holds the PDF document in which links are to be found.


page : int

This property holds the page number on which links are to be found.


© 2024 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.