QtCreater增加自动添加注释的快捷代码

简介: QtCreater增加自动添加注释的快捷代码

在QtCreater中,可以通过添加一些关键字来自动生成一些信息,比如注释信息;


方法如下


工具–>选项:


添加关键字以及文本:


下面的%{CurrentDate:yyyy-MM-dd}是去时间的。


设置好以后点击OK,返回试一下效果:


然后按回车,注释信息就上去了:


函数注释信息

/***************************************************************
* @function name: 
* @摘要            
* @输入参数
* @输出参数          无
* @返回值            void
* @author           fensnote
* @date             %{CurrentDate:yyyy-MM-dd} 
**************************************************************/


文件头信息


如果是文件头信息的话,可以把文件名也自动提取上,如下代码:

/******************************************************************************

  Copyright (C), 2017-2027, fensnote@163.com, Ltd.

 ******************************************************************************
  File Name     : %{CurrentDocument:FileName} 
  Version       : 1.0
  Author        : fensnote
  Created       : %{CurrentDate:yyyy-MM-dd} 
  Last Modified :
  Description   :  header file
  Function List :
  History       :
  1.Date        : %{CurrentDate:yyyy-MM-dd} 
    Author      : fensnote
    Modification: Created file

******************************************************************************/


效果是这样的:

/******************************************************************************
  
  Copyright (C), 2017-2027, fensnote@163.com, Ltd.
  
 ******************************************************************************
  File Name     : main.cpp 
  Version       : 1.0
  Author        : fensnote
  Created       : 2022-04-13 
  Last Modified :
  Description   :  header file
  Function List :
  History       :
  1.Date        : 2022-04-13 
    Author      : fensnote
    Modification: Created file
    
******************************************************************************/


附内部变量

%{#:<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:<value>}
%{CurrentBuild:Name}
%{CurrentBuild:Type}
%{CurrentDate:<value>}
%{CurrentDate:ISO}
%{CurrentDate:Locale}
%{CurrentDate:RFC}
%{CurrentDevice:HostAddress}
%{CurrentDevice:PrivateKeyFile}
%{CurrentDevice:SshPort}
%{CurrentDevice:UserName}
%{CurrentDocument:Column}
%{CurrentDocument:ColumnCount}
%{CurrentDocument:FileBaseName}
%{CurrentDocument:FileName}
%{CurrentDocument:FilePath}
%{CurrentDocument:FontSize}
%{CurrentDocument:NativeFilePath}
%{CurrentDocument:NativePath}
%{CurrentDocument:Path}
%{CurrentDocument:Row}
%{CurrentDocument:RowCount}
%{CurrentDocument:Selection}
%{CurrentDocument:XPos}
%{CurrentDocument:YPos}
%{CurrentKit:FileSystemName}
%{CurrentKit:Id}
%{CurrentKit:Name}
%{CurrentProject:BuildPath}
%{CurrentProject:FileBaseName}
%{CurrentProject:FileName}
%{CurrentProject:FilePath}
%{CurrentProject:Name}
%{CurrentProject:NativeFilePath}
%{CurrentProject:NativePath}
%{CurrentProject:Path}
%{CurrentProject:QT_HOST_BINS}
%{CurrentProject:VcsName}
%{CurrentProject:VcsTopLevelPath}
%{CurrentProject:VcsTopic}
%{CurrentRun:Executable:FileBaseName}
%{CurrentRun:Executable:FileName}
%{CurrentRun:Executable:FilePath}
%{CurrentRun:Executable:NativeFilePath}
%{CurrentRun:Executable:NativePath}
%{CurrentRun:Executable:Path}
%{CurrentRun:Name}
%{CurrentTime:<value>}
%{CurrentTime:ISO}
%{CurrentTime:Locale}
%{CurrentTime:RFC}
%{Env:<value>}
%{HostOs:ExecutableSuffix}
%{HostOs:PathListSeparator}
%{HostOs:isLinux}
%{HostOs:isOSX}
%{HostOs:isUnix}
%{HostOs:isWindows}
%{IDE:ResourcePath}
%{JS:<value>}
%{Session:FileBaseName}
%{Session:FileName}
%{Session:FilePath}
%{Session:Name}
%{Session:NativeFilePath}
%{Session:NativePath}
%{Session:Path}
%{UUID}

目录
相关文章
|
计算机视觉 Windows
Qt实用技巧:实现窗口透明的五种方法
Qt实用技巧:实现窗口透明的五种方法
Qt实用技巧:实现窗口透明的五种方法
|
Unix 编译器 开发者
Qt5.14.2 轻松掌握Qt中的压缩与解压缩:QuaZIP的神秘面纱与实战演练之windows环境编译
Qt5.14.2 轻松掌握Qt中的压缩与解压缩:QuaZIP的神秘面纱与实战演练之windows环境编译
1732 0
|
SQL 数据库 数据库管理
Qt操作Sqlite类封装,及命令行导入csv文件到Sqlite数据库
Qt操作Sqlite类封装,及命令行导入csv文件到Sqlite数据库
|
API UED
【Qt 学习笔记】Qt窗口 | 状态栏 | QStatusBar的使用及说明
【Qt 学习笔记】Qt窗口 | 状态栏 | QStatusBar的使用及说明
2826 4
Qt对动态库(*.dll)的封装以及使用
Qt对动态库(*.dll)的封装以及使用
1520 0
|
UED
【Qt 学习笔记】Qt窗口 | 工具栏 | QToolBar的使用及说明
【Qt 学习笔记】Qt窗口 | 工具栏 | QToolBar的使用及说明
2670 2
【Qt 学习笔记】Qt常用控件 | 显示类控件 | Progress Bar的使用及说明
【Qt 学习笔记】Qt常用控件 | 显示类控件 | Progress Bar的使用及说明
2808 0
|
存储 数据可视化 NoSQL
Qt Creator的CDB调试器--使用技巧与解决调试很慢的心得,重点是Symbols Path设置
Qt Creator的CDB调试器--使用技巧与解决调试很慢的心得,重点是Symbols Path设置
3879 0
Qt Creator的CDB调试器--使用技巧与解决调试很慢的心得,重点是Symbols Path设置
|
Linux 图形学
深入理解Qt定时器:QTimer的魅力与挑战(一)
深入理解Qt定时器:QTimer的魅力与挑战
8652 0
|
C++ 索引
【Qt 学习笔记】如何在Qt中打印日志 | qDebug的使用 | Assistant的使用
【Qt 学习笔记】如何在Qt中打印日志 | qDebug的使用 | Assistant的使用
2320 0

热门文章

最新文章