QtCreator doesn't allow using clang-format by default. Watch QTCREATORBUG-10111 for a better integration. For now, you should use it as an external tool, either replacing your selection (described below) or the entire file.
For Windows, download LLVM from http://llvm.org/builds/. You don't need to add it to the PATH, you can use it with the absolute path.
In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool).
- Arguments:
-style="{BasedOnStyle: llvm, ColumnLimit: 80, Standard: Cpp11, IndentWidth: 4, BreakBeforeBraces: Linux}"
- Working dir:
%{CurrentProject:Path}
- Output: replace selection
- Error output: show in pane
- Don't tick the "Modifies current document" (this will ask you to save the document before running the tool and should be ticked if you want to update the whole file instead of only the selection)
- Input:
%{CurrentDocument:Selection}
See these for all possible parameters and enum values (that are not listed in the -help option):
Thank you! It works nicely.