控件工具示例

展示各种完成选项和工具的应用程序

Qt 为基于控件的应用程序提供了自动完成、撤销/重做操作以及正则表达式等功能。

Completer Example

Completer 示例展示了如何基于模型提供的数据,为输入控件提供字符串补全功能。

Custom Completer Example

“自定义补全器”示例展示了如何基于模型提供的数据为输入控件提供字符串补全功能。补全器会根据用户输入的前三个字符弹出可能的单词建议,并通过 QTextCursor 将用户选择的单词插入到 TextEdit 中。

QRegularExpression Example

QRegularExpression 示例通过提供一个环境,在该环境中可以创建新的正则表达式并在自定义文本字符串上进行测试,从而展示了如何在 Qt 中将正则表达式应用于文本。

Tree Model Completer Example

“树模型补全器”示例演示了如何为分层模型提供补全功能,使用句点作为分隔符来访问子、孙和曾孙级别的对象。

Undo Framework Example

本示例展示了如何使用 Qt 撤销框架实现撤销/重做功能。

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