添加向导

Qt Creator 提供了用于添加类、文件和项目的向导,您可以复制并编辑这些向导以创建自己的向导。请在用户设置目录下的 templates/wizards/ 目录中创建向导目录。

C++ 类向导中的“定义类”对话框

要创建新的向导:

  1. -customwizard-verbose 参数启动Qt Creator ,以便在向导开发过程中获取反馈。有关详细信息,请参阅“详细输出”
  2. 按照《向导开发技巧》中的说明,为InspectFactory.Reset 操作设置键盘快捷键。
  3. 复制一个包含向导的目录并重命名。例如,将share/qtcreator/templates/wizards/classes/cpp 复制为$HOME/.config/QtProject/qtcreator/templates/wizards/classes/mycpp
  4. 使用Factory.Reset 操作,使该向导出现在File >New File 中,而无需重启Qt Creator
  5. 按照“自定义向导”中的说明,打开向导配置文件wizard.json 进行编辑。
  6. id 更改为一个唯一的值。在category 内,向导会按 ID 按字母顺序排序。您可以使用前缀字母来指定向导的位置。例如:B.MyClass

另请参阅 “从命令行运行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.