QT Creator 代码格式化

在QTC(help->About Plugins)中启用  Beautifier,重启QTC就可以使用这个插件了.


在QTC中找到Beautifier的插件设置。


点击Edit 输入下面内容:

AccessModifierOffset: 0

AlignEscapedNewlinesLeft: false

AlignTrailingComments: true

AllowAllParametersOfDeclarationOnNextLine: false

AllowShortFunctionsOnASingleLine: false

AllowShortIfStatementsOnASingleLine: false

AllowShortLoopsOnASingleLine: false

AlwaysBreakBeforeMultilineStrings: false

AlwaysBreakTemplateDeclarations: false

BinPackParameters: false

BreakBeforeBinaryOperators: false

BreakBeforeTernaryOperators: false

BreakConstructorInitializersBeforeComma: false

ColumnLimit: 128

BreakBeforeBraces: Attach

CommentPragmas: ''

ConstructorInitializerAllOnOneLineOrOnePerLine: false

ConstructorInitializerIndentWidth: 0

ContinuationIndentWidth: 0

Cpp11BracedListStyle: false

DerivePointerBinding: false

IndentCaseLabels: true

IndentFunctionDeclarationAfterType: false

IndentWidth: 4

Language: Cpp

MaxEmptyLinesToKeep: 1

NamespaceIndentation: None

ObjCSpaceAfterProperty: true

ObjCSpaceBeforeProtocolList: true

ObjCBlockIndentWidth: 4

PenaltyBreakBeforeFirstCallParameter: 100

PenaltyBreakComment: 100

PenaltyBreakFirstLessLess: 0

PenaltyBreakString: 100

PenaltyExcessCharacter: 1

PenaltyReturnTypeOnItsOwnLine: 20

SpaceBeforeAssignmentOperators: true

SpaceBeforeParens: ControlStatements

SpaceInEmptyParentheses: false

SpacesBeforeTrailingComments: 1

SpacesInAngles: false

SpacesInCStyleCastParentheses: false

SpacesInContainerLiterals: false

SpacesInParentheses: false

TabWidth: 4

UseTab: Never

____________________________________________

VS 风格:

BasedOnStyle: LLVM

AccessModifierOffset: -4

AllowShortIfStatementsOnASingleLine: false

BreakBeforeBraces: Allman

ColumnLimit: 0

IndentCaseLabels: false

IndentWidth: 4

SortIncludes: false

TabWidth: 4

你可能感兴趣的:(QT Creator 代码格式化)