C/C++, IDE, Programming

Qt – Cross-platform software development


Beautifying Source Code

  • Download Artistic Style
  • Extract astyle to e.g. Documents
  • Open qt creator
  • Goto Help -> About Plugins -> C++ -> Load Beautifier
  • Restart qt creator
  • Goto Tools -> Options… -> Beautifier -> General -> Check “Enable auto format on file save” and “Restrict to files contained in the current project“. Make sure that Artistic Style is selected as default Tool.
  • Goto Artistic Style Tab -> set Artistic Style command, e.g.
  • Goto Artistic Style Tab -> select “Use file *.astylerc defined in project files
  • Click Add button to your style.
  • Name it e.g. “mystyle”.
  • Copy paste the following style into Value textbox:
  • Click OK.
  • Select “Use customized style” and select your style.
  • Click OK.

Beautifying Source Code Keyboard shortcut

  • Goto Tools -> Options… -> Environment -> Keyboard -> find ArtisticStyle (FormatFile)
  • Record a new key sequence e.g. Ctrl+E, Ctrl+D (Visual Studio shortcut).

Create an empty file %APPDATA%\QtProject\qtcreator\beautifier\documentation\artisticstyle.xml if you get an error about artisticstyle.xml missing.