将代码用方括号或引号括起来

选中代码,然后输入以下任一起始字符,系统会在选定范围末尾自动添加对应的结束字符:

  • (
  • {
  • [
  • <
  • "
  • '

若要指定是否自动插入匹配字符,请转至Preferences >Text Editor >Completion ,并在Automatically Insert Matching Characters 中选择相应选项。

文本编辑器首选项中的“自动补全”选项卡

此外,Qt Creator 会自动插入原始字符串字面量前缀的闭合字符。

另请参阅 “代码补全”“操作指南:编辑代码”和“编辑代码”。

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.