ETextEditor 富文本编辑
示例与代码
富文本与格式工具
只读内容
隐藏工具栏
选中文本格式
占位与粘贴
属性
属性说明取值与默认值
showToolbarbool显示富文本格式工具栏。
默认值
truetextalias编辑器的 Qt RichText HTML 内容。
默认值
editor.textplaceholderTextstring空值时显示的占位文字。
默认值
""readOnlyalias保持内容可见并禁止用户修改。
默认值
editor.readOnlyeditoralias只读底层 TextEdit 实例。
默认值
editorcanRedobool只读是否有可以重做的编辑操作。
默认值
editor.canRedocanUndobool只读是否有可以撤销的编辑操作。
默认值
editor.canUndoplainTextstring只读富文本内容对应的纯文本。
默认值
editor.getText(0, editor.length)currentFormatvar只读光标当前位置的字符格式与段落对齐信息。
默认值
展开默认值
{ const position = editor.cursorPosition const revision = state.revision return document.formatAt(position) }信号
签名作用
formatApplied(string operation)应用文字格式后触发,operation 为执行的格式操作。
方法
签名作用
redo()重做已撤销的文字编辑。
undo()撤销上一次文字编辑。
applyFormat(operation, value)对选中文字应用 operation 指定的格式,value 为格式值;返回是否成功。