启用 QtCreator Beautifier 插件
选择 Help --> 在搜索里面查找 plugin 选择 About plugin, 在 C++ 选项中,选中 Beautifier,之后重启 QtCreator
在 macos 安装 clang-format
终端执行:
brew install clang-format
成功之后,执行
which clang-format
会输出一个 clang-format 执行文件的路径,复制这个路径:
/usr/local/bin/clang-format
配置 Beautifier
选择 QtCreator --> preferences --> beautifier, 做如下配置,确定,重启 QtCreator 即可