QPdfSelection Class | Qt PDF | Qt 6.11.2
Description: The QPdfSelection class defines a range of text that has been selected on one page in a PDF document, and its geometric boundaries.

- Qt 6.11
- Qt PDF
- C++ Classes
- QPdfSelection
- Qt 6.11.2 Reference Documentation

# QPdfSelection Class

The QPdfSelection class defines a range of text that has been selected on one page in a PDF document, and its geometric boundaries. More...

Header: | `#include <QPdfSelection>`

- List of all members, including inherited members

## Properties

boundingRectangle : QRectF bounds : QList<QPolygonF> endIndex : int | startIndex : int text : QString valid : bool

## Public Functions

QRectF | boundingRectangle() const
QList<QPolygonF> | bounds() const
void | copyToClipboard(QClipboard::Mode mode = QClipboard::Clipboard) const
int | endIndex() const
bool | isValid() const
int | startIndex() const
QString | text() const

## Detailed Description

See also QPdfDocument::getSelection().

## Property Documentation

### `[read-only]` boundingRectangle : QRectF

This property holds the overall bounding rectangle (convex hull) around bounds.

Access functions:

QRectF | boundingRectangle() const

### `[read-only]` bounds : QList<QPolygonF>

This property holds a set of regions that the selected text occupies on the page, represented as polygons. The coordinate system for the polygons has the origin at the upper-left corner of the page, and the units are points.

Note: For now, the polygons returned from QPdfDocument::getSelection() are always rectangles; but in the future it may be possible to represent more complex regions.

Access functions:

QList<QPolygonF> | bounds() const

### `[read-only]` endIndex : int

This property holds the index at the end of text within the full text on the page.

Access functions:

int | endIndex() const

### `[read-only]` startIndex : int

This property holds the index at the beginning of text within the full text on the page.

Access functions:

int | startIndex() const

### `[read-only]` text : QString

This property holds the selected text.

Access functions:

QString | text() const

### `[read-only]` valid : bool

This property holds whether the selection is valid.

Access functions:

bool | isValid() const

## Member Function Documentation

### void QPdfSelection::copyToClipboard(QClipboard::Mode mode = QClipboard::Clipboard) const

Copies text to the system clipboard depending on the mode selected.