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

PdfSelection QML Type

A representation of a text selection 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+   

PdfSelection QML Type

  • Import Statement: import QtQuick.Pdf

  • Since:: Qt 5.15

  • Inherits:: Item

  • Group: PdfSelection is part of pdf

Detailed Description

PdfSelection provides the text string and its geometry within a bounding box from one point to another.

To modify the selection using the mouse, bind from and to to the suitable properties of an input handler so that they will be set to the positions where the drag gesture begins and ends, respectively; and bind the hold property so that it will be set to true during the drag gesture and false when the gesture ends.

PdfSelection also directly handles Input Method queries so that text selection handles can be used on platforms such as iOS. For this purpose, it must have keyboard focus.

Property Documentation

 

document : PdfDocument

This property holds the PDF document in which to select text.

from : point

The beginning location, in pixels from the upper-left corner of the page, from which to find selected text. This can be bound to the centroid.pressPosition of a DragHandler to begin selecting text from the position where the user presses the mouse button and begins dragging, for example.

geometry : list<list<point>>

A set of paths in a form that can be bound to the paths property of a PathMultiline instance to render a batch of rectangles around the text regions that are included in the selection:

 
Sélectionnez
PdfDocument {
    id: doc
}
PdfSelection {
    id: selection
    document: doc
    from: textSelectionDrag.centroid.pressPosition
    to: textSelectionDrag.centroid.position
    hold: !textSelectionDrag.active
}
Shape {
    ShapePath {
        PathMultiline {
            paths: selection.geometry
        }
    }
}
DragHandler {
    id: textSelectionDrag
    acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus
    target: null
}
See Also

See also PathMultiline

hold : bool

Controls whether to hold the existing selection regardless of changes to from and to. This property can be set to true when the mouse or touchpoint is released, so that the selection is not lost due to the point bindings changing.

page : int

The page number on which to search.

See Also

renderScale : real

The ratio from points to pixels at which the page is rendered.

This is used to scale from and to to find ranges of selected characters in the document, because positions within the document are always given in points.

string : string

The string found.

to : point

The ending location, in pixels from the upper-left corner of the page, from which to find selected text. This can be bound to the centroid.position of a DragHandler to end selection of text at the position where the user is currently dragging the mouse, for example.

Method Documentation

 

void clear()

Clears the current selection.

void copyToClipboard()

Copies plain text from the string property to the system clipboard.

void selectAll()

Selects all text on the current page.

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