coding-style - Qt Creator 编码风格 : How to force new line before the opening brace?

标签 coding-style qt-creator

默认情况下有no line break在 Qt Creator 中的左大括号之前。我怎样才能覆盖这种行为?

最佳答案

有很多工具可以实现这一点,“艺术风格”是我使用的一个。 http://astyle.sourceforge.net/

安装艺术风格

QtCreator -> 工具 -> 选项 -> 美化器

(如果它不存在,请在“帮助”->“关于插件...”中启用它)

在“艺术风格”选项卡上选中“使用自定义风格”并单击“编辑”

在文本框中输入“--style=allman”(不带引号),然后确定,确定。

然后是工具 -> 美化器 -> 艺术风格 -> 设置当前文件格式

要查看所有可用选项(以及“--style=allman”的作用),请参阅 http://astyle.sourceforge.net/astyle.html#_Bracket_Style_Options

关于coding-style - Qt Creator 编码风格 : How to force new line before the opening brace?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18072930/

相关文章:

.net - 哪个是最重要的代码分析规则,为什么?

ruby-on-rails - 如何防止过多的 if-else 条件

c++ - QT造物主: How to generate the library and testing executable for a custom widget

debugging - 调试时禁用 qt creator 自动构建

javascript - 在 JavaScript 中将数字转换为字符串的最佳方法是什么?

iphone - 避免代码中的调试内容困惑

java - 到处使用 `final` 修饰符的开源 Java 项目

c++ - QAbstractItemModel::removeRows 会导致内存泄漏吗?

c++ - Qt Creator 代码文件重构

c++ - 如何让 DCMTK 库在 Qt Creator 中工作?