TextSelection QML Type

代表连续的文本选区及其属性。更多

Import Statement: import QtQuick
Since: Qt 6.7

属性

详细说明

TextEdit.cursorSelection 表示当前选定(例如通过拖动鼠标选定)的文本范围。它可用于查询和修改选中的文本,以及 和 格式的属性。character block

注意: 该 API 被视为技术预览版,可能会在未来的 Qt 版本中更改或删除。

另请参阅 TextEditQTextCursor

属性文档

alignment : enumeration

包含选定文本的块的对齐方式。

另请参阅 QTextBlockFormat::alignment() 。


color : color

选中文本的前景色。

另请参见 QTextCharFormat::foreground()。


font : color

所选文本的字体。

另请参阅 QTextCharFormat::font()。


text : string

不带任何富文本标记的选中文本。

设置此属性后,所选文本将替换为给定的字符串。


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