Qt6Cractor初始化

原文地址

原文链接

下载

下载地址,需要同意GPL或者LGPL开源协议

优化

页面过小

windowsqt在没有比例放大的情况下,会出现工具栏等比例太小的问题,不调整windows缩放比的情况下没有特别好的解决方案。可以使用脚本单独调整qt的比例,但是部分位置比例会变得奇怪,在qtcreator.exe同级目录下创建文件qtcreatorStart.cmd

@echo off 
set QT_SCALE_FACTOR=1.2
qtcreator.exe

Linux下同样有效

export QT_SCALE_FACTOR=1.2

代码格式化

在【帮助】-【关于插件】中添加【Beautifier】插件,重启后在左侧菜单栏【项目】-【管理构建套件】-【Beautifier】中选择美化引擎,目前可以选择的引擎有Artistic StyleUncrustify以及ClangFormat这里以ClangFormat举例

下载地址

在【Beautifier】-【ClangFormat】选项卡中选择安装的位置下的#{address}/bin/clang-format.exe作为引擎,配置自定义的风格,这里给出示例

AccessModifierOffset:   -4
AlignAfterOpenBracket:  Align
AlignConsecutiveAssignments:    true
AlignConsecutiveDeclarations:   true
AlignEscapedNewlinesLeft:   true
AlignOperands:  true
AlignTrailingComments:  true
AllowAllParametersOfDeclarationOnNextLine:  true
AllowShortBlocksOnASingleLine:  false
AllowShortCaseLabelsOnASingleLine:  false
AllowShortFunctionsOnASingleLine:   Empty
AllowShortIfStatementsOnASingleLine:    false
AllowShortLoopsOnASingleLine:   false
AlwaysBreakAfterDefinitionReturnType:   None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings:  false
AlwaysBreakTemplateDeclarations:    false
BinPackArguments:   true
BinPackParameters:  true
BraceWrapping:
  AfterClass:   true
  AfterControlStatement:    true
  AfterEnum:    true
  AfterFunction:    true
  AfterNamespace:   true
  AfterObjCDeclaration: true
  AfterStruct:  true
  AfterUnion:   true
  BeforeCatch:  true
  BeforeElse:   true
  IndentBraces: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces:  Custom
BreakBeforeTernaryOperators:    true
BreakConstructorInitializersBeforeComma:    true
ColumnLimit:    200
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth:  4
ContinuationIndentWidth:    4
Cpp11BracedListStyle:   false
DerivePointerAlignment: false
DisableFormat:  false
ExperimentalAutoDetectBinPacking:   false
ForEachMacros:  [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
  - Regex:  '^"(llvm|llvm-c|clang|clang-c)/'
    Priority:   2
  - Regex:  '^(<|"(gtest|isl|json)/)'
    Priority:   3
  - Regex:  '.*'
    Priority:   1
IndentCaseLabels:   false
IndentWidth:    4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks:   true
MacroBlockBegin:    ''
MacroBlockEnd:  ''
MaxEmptyLinesToKeep:    1
NamespaceIndentation:   Inner
ObjCBlockIndentWidth:   4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList:    true
PenaltyBreakBeforeFirstCallParameter:   19
PenaltyBreakComment:    300
PenaltyBreakFirstLessLess:  120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine:  60
PointerAlignment:   Left
ReflowComments: true
SortIncludes:   true
SpaceAfterCStyleCast:   false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens:  ControlStatements
SpaceInEmptyParentheses:    false
SpacesBeforeTrailingComments:   2
SpacesInAngles: false
SpacesInContainerLiterals:  true
SpacesInCStyleCastParentheses:  true
SpacesInParentheses:    false
SpacesInSquareBrackets: false
Standard:   Cpp11
TabWidth:   4
UseTab: Never

文档参考:ClangFormatClangFormatStyleOptionsclang-format的介绍和使用

在【Beautifier】-【概要】选项卡中根据需要决定是否在保存时候就执行format操作

修改快捷键

【项目】-【管理构建套件】-【环境】-【键盘】

  • 检索GoBackGoForward改为Ctrl + Alt + <-Ctrl + Alt + ->
  • 检索CompleteThis改为Ctrl + p,将冲突快捷键重置为空
  • 检索RenameSymbolUnderCursor,改为Shift + F6,将冲突快捷键重置为空

原文地址

原文链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值