IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

PdfLinkModel QML Type

A representation of links within a PDF document.

This type was introduced in Qt 5.15.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

PdfLinkModel QML Type

  • Import Statement: import QtQuick.Pdf

  • Since:: Qt 5.15

  • Group: PdfLinkModel is part of pdf

Detailed Description

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

The available model roles are:

Constant

Description

rectangle

Bounding rectangle around the link.

url

If the link is a web link, the URL for that; otherwise an empty URL.

page

If the link is an internal link, the page number to which the link should jump; otherwise -1.

location

If the link is an internal link, the location on the page to which the link should jump.

zoom

If 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:

 
Sélectionnez
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)
            }
        }
    }
}

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.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+