- Qt 6.7
- Qt Quick
- QML Types
- TextSelection
- Qt 6.7.1 Reference Documentation

# TextSelection QML Type

Represents a contiguous selection of text and its properties. More...

Import Statement: | import QtQuick
Since: | Qt 6.7

- List of all members, including inherited members

## Properties

- alignment : enumeration
- color : color
- font : color
- text : string

## Detailed Description

TextEdit.cursorSelection represents the range of text that is currently selected (for example by dragging the mouse). It can be used to query and modify the selected text, as well as properties in the character and block formats.

Note: This API is considered tech preview and may change or be removed in future versions of Qt.

See also TextEdit and QTextCursor.

## Property Documentation

alignment : enumeration

The alignment of the block containing the selected text.

See also QTextBlockFormat::alignment().

color : color

The foreground color of the selected text.

See also QTextCharFormat::foreground().

font : color

The font of the selected text.

See also QTextCharFormat::font().

text : string

The selected text, without any rich text markup.

Setting this property replaces the selected text with the given string.