在当前文件中搜索
增量搜索会在输入的同时在编辑器中高亮显示匹配的字符串。
要搜索当前打开的文件,请
- 选择Ctrl+F或转到Edit >Find/Replace >Find/Replace 。
- 在Find 中,输入您要查找的文本。
在您键入时,编辑器会高亮显示该文本的所有出现位置。
- 要转到下一次出现的文本,请选择
(Find Next) 或F3。
- 要转到上一次出现的文本,请选择
(Find Previous) 或Shift+F3。
- 要选择文件中找到的所有出现,请选择Select All 。
注意: 在选择Find/Replace 之前选择文本,以便仅从选中内容中进行搜索。
设置搜索标准
要限制Find 框中的搜索,请选择 (New Search) 并设置搜索标准:
- 要区分大小写搜索,请选择Case Sensitive 。
- 要只搜索整词,请选择Whole Words Only 。
- 要使用regular expressions 进行搜索,请选择Use Regular Expressions 。Qt Creator 中使用的正则表达式以 Perl 正则表达式为蓝本
替换文本
要替换现有文本,请在Replace with 中输入新文本。
- 要替换选定的出现项,请选择Replace 。
- 要替换选中的内容并移动到下一个,请选择Replace & Find 。
- 要替换文件中所有出现的文本,请选择Replace All 。
替换时保留大小写
要在替换时保留原始文本的大小写,请选择 (New Search) ,然后选择Preserve Case when Replacing 。此选项不能与Use Regular Expressions 一起使用。
出现的大小写将根据以下规则保留:
- 所有大写出现的文本均替换为大写的新文本。
- 所有小写出现的内容都将替换为小写的新文本。
- 大写内容用大写的新文本替换。
- 其他内容用输入的新文本替换。
- 如果出现和新文本的前缀或后缀相同,则保留前缀和后缀的大小写,其他规则适用于出现的其他部分。
突出显示搜索结果
编辑器滚动条上会高亮显示文档中的搜索结果、断点和书签的位置。要关闭高亮显示,请选择首选项>Text Editor >Display >Highlight search results on the scrollbar 。
全局搜索
选择Advanced 可打开Search Results 视图,在此可搜索当前打开的项目或文件系统中的文件。或者,搜索符号以重构代码。
Copyright © The Qt Company Ltd. and other contributors. 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.