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}

目录
相关文章
|
7月前
|
数据库
Layui入门&动态树&动态选项卡&用户增加&修改&删除&(一)
Layui入门&动态树&动态选项卡&用户增加&修改&删除&
|
6天前
|
前端开发 JavaScript 安全
神奇的代码——可随意修改复制页面内容
神奇的代码——可随意修改复制页面内容
17 0
|
9月前
DedeCMS织梦文档关键词维护中设置自动关键词重复嵌套出错的修改方法
织梦 DedeCMS 后台的关键词维护默认的情况是字数少的词优先于字数多的词,比如我们有两个这样的词:锚文本、定向锚文本,第二个词包含了第一个词,在文章中如果出现“定向锚文本”这个词,默认情况下只会给锚文本两个字添加关键词超链接,而不是整个词,那么我们怎么样才能实现字数多的词优先于字数少的词呢?
|
6天前
|
Python
【python自动办公】批量更改Excel中大量工作表的内容(附源码 有注释)
【python自动办公】批量更改Excel中大量工作表的内容(附源码 有注释)
37 0
|
7月前
Layui入门&动态树&动态选项卡&用户增加&修改&删除&(二)
Layui入门&动态树&动态选项卡&用户增加&修改&删除&
|
人工智能 JavaScript IDE
自动写代码?别闹了!
这几天,GitHub 上有个很火的插件在抖音刷屏了——Copilot。 这个神器有啥用呢?简单来讲,它就是一款由人工智能打造的编程辅助工具。 我们来看看它有啥用。
319 0
Geany 代码自动补齐功能设置
Geany 代码自动补齐功能设置
297 0
Geany 代码自动补齐功能设置
Geany整体注释和取消注释快捷键
Geany整体注释和取消注释快捷键
421 0
Geany整体注释和取消注释快捷键
Geany整体增加减少缩进快捷键
Geany整体增加减少缩进快捷键
150 0
Geany整体增加减少缩进快捷键