当前位置:网站首页>Qt Creator代码风格插件Beautifier
Qt Creator代码风格插件Beautifier
2022-07-27 07:59:00 【唐顺才】
前言
Qt Creator自身可以通过Ctrl+A全选Ctrl+i自动格式化,此处的格式化应该只限于缩进格式化,但不会对大括号位置、小括号前后空格、运算符前后空格等进行格式化操作,要实现类似于VS的全面的代码风格格式化,需要利用插件。
1、开启Beautifier插件
帮助 -> 关于插件

重启qt Creator
2、配置Astyle
启动插件后在工具-选项中会具有Beautifier的配置项,启动此功能,并选择为Artisitic Style,Qt还支持另外两个ClangFomat和Uncrustify。
(1) 下载 http://astyle.sourceforge.net/ 到上述页面,选择download,然后download latest version即可下载win版本,无论编译器是vs还是mingw均可用,如果是linux下使用qt,需要单独打开下方的文件夹下载最新版的linux文件自行编译。
例如存放到windows目录: D://format

(2) 配置

自定义编码风格
astyle提供了一系列内置的代码风格:
style=allman style=java style=kr style=stroustrup style=whitesmith style=vtk style=ratliff style=gnu style=linux style=horstmann style=1tbs style=google style=mozilla style=pico style=lisp
需要在Artisitic style的use custom style中通过Add添加
主动触发代码格式化:打开某个文档,然后通过工具 -> Beautifier -> Artisitic style -> Fomat即可对当前文档格式化:
自动使用:任意文档在修改保存时均会自动格式化:
开启vim编辑:
wq!
边栏推荐
猜你喜欢

Comprehensive cases

Internet of things industrial UART serial port to WiFi to wired network port to Ethernet Gateway WiFi module selection

Convert objects to key value pairs

OpenGL shader learning notes: varying variables

DEMO SUBMIT 某程序并获取该程序ALV数据

Happy holidays, everyone

【小程序】uniapp发行微信小程序上传失败Error: Error: {'errCode':-10008,'errMsg':'invalid ip...

【飞控开发基础教程4】疯壳·开源编队无人机-串口(光流数据获取)

Hu related configuration

【pytorch】ResNet18、ResNet20、ResNet34、ResNet50网络结构与实现
随机推荐
物联网工业级UART串口转WiFi转有线网口转以太网网关WiFi模块选型
[stonedb class] introductory lesson 1: popular science of database knowledge
How to obtain the cash flow data of advertising services to help analyze the advertising effect?
Gossip: it's really important to have a rod in your hand and a net on your shoulder. As for how many fish are in the basket?
The dragon lizard exhibition area plays a new trick this time. Let's see whose DNA moved?
Interview reply V
API 版本控制【 Eolink 翻译】
The integrated real-time HTAP database stonedb, how to replace MySQL and achieve nearly 100 times the improvement of analysis performance
[ten thousand words long article] thoroughly understand load balancing, and have a technical interview with Alibaba Daniel
将对象转换为键值对
DEMO:PA30 银行国家码默认CN 增强
C event usage case subscription event+=
On data security
Shell scripts related
Resttemplate connection pool configuration
为啥国内大厂都把云计算当成香饽饽,这个万亿市场你真的了解吗
综合案例、
A quick overview of transformer quantitative papers in emnlp 2020
Usage scenarios for automated testing
DEMO SUBMIT 某程序并获取该程序ALV数据