qt creator插入代码块快速注释snippets代码片段的功能

定义

任何开发IDE中,一般都提供snippets代码片段的功能,就是为了方便快捷的插入格式一致的代码段或者注释段。

步骤

  1. qt creator 添加头文件,源文件的注释功能。
  2. 在qt creator的"工具"->“选项”->“Snippets”,添加hfile,cppfile作为触发条件。
    请添加图片描述

hfile一般是对头文件的注释,头文件的注释一般包括license和头文件信息的描述,参考如下

/**
* This file is part of the QtWidgets module of the Qt Toolkit.
* Copyright (C) 2016 The Qt Company Ltd.
* Commercial License Usage
* Licensees holding valid commercial Qt licenses may use this file in
* accordance with the commercial license agreement provided with the
* Software or, alternatively, in accordance with the terms contained in
* a written agreement between you and The Qt Company. For licensing terms
* and conditions see https://www.qt.io/terms-conditions. For further
* information use the contact form at https://www.qt.io/contact-us.
*/
/**
*    @file:    %{CurrentDocument:FileName}
*    @brief:   
*    @author:  412351345@qq.com
*    @date:    %{CurrentDate:yyyy-MM-dd}  %{CurrentTime:hh:mm}
*/

cppfile一般只包括源文件描述即可,参考:

/**
*    @file:    %{CurrentDocument:FileName}
*    @brief:   
*    @author:  412351345@qq.com
*    @date:    %{CurrentDate:yyyy-MM-dd}  %{CurrentTime:hh:mm}
*/
  1. 添加好后保存

  2. 在头文件中,输入hfile,回车即可。

请添加图片描述

  1. 另一个快捷键是对函数注释的,在函数声明之前输入/**然后回车,即可插入对函数的注释

请添加图片描述

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

苏克贝塔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值