打开 Qt Creator,菜单选择:工具 -> 选项 -> 文本编辑器 -> 片段。点击“添加”按钮,编辑自定义的“触发”。
打开 Qt Creator,菜单选择:Tools->Options->Text Editor->Snippets->Text->Add
使用:代码中输入出发 header ,弹出custom, 回车选中即可
/**
* @fileName %{CurrentProject:FileName}
* @brief
* @author Mr.Song
* @date %{CurrentDate:yyyy-MM-dd}
*/

qt内部变量大全
%{#:<value>
%{Config:DefaultProjectDirectory}
%{Config:LastFileDialogDirectory}
%{Cpp:LicenseTemplate}
%{Cpp:LicenseTemplatePath:FileBaseName}
%{Cpp:LicenseTemplatePath:FileName}
%{Cpp:LicenseTemplatePath:FilePath}
%{Cpp:LicenseTemplatePath:NativeFilePath}
%{Cpp:LicenseTemplatePath:NativePath}
%{Cpp:LicenseTemplatePath:Path}
%{CurrentBuild:Env

本文介绍了如何在Qt Creator中添加自定义注释模板。通过菜单工具 -> 选项 -> 文本编辑器 -> 片段,点击添加,设置触发关键字如'header',然后在代码中输入该触发词,回车选择自定义的注释模板,可以快速生成包含文件名、作者、日期等信息的注释。
最低0.47元/天 解锁文章
1736





