Last active
November 3, 2019 16:19
Revisions
-
Uflex revised this gist
Apr 30, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ Clang-format in QtCreator ========================= **Edit**: QtCreator 3.1 introduced a new plugin called Beautifier that supports clang-format. You still have to install the clang tools separately but you don't have to add them as external tools anymore. The plugin can be configured in the options dialog under the beautifier tab > Clang Format. Add a new style and copy the configuration below without the curly braces. QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111](https://bugreports.qt-project.org/browse/QTCREATORBUG-10111) for a better integration. As of today, you should use it as an external tool, either replacing your selection or the entire file. If you choose to replace the file, you will have to save it before launching the tool and QtCreator will reload the file, making it impossible to undo/redo afterwards. If you choose to replace your selection, you often have to select the whole function, otherwise you will lose the indentation; clang-format doesn't seem to keep the leading spaces. When you run clang-format on your selection, Creator marks the whole selection as changed, even if nothing moved. This is a minor inconvenience and anyway the "Auto-indent Selection" built-in with Creator does the same thing. ### Installation -
Uflex revised this gist
Feb 7, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,6 @@ See these links for all possible parameters and enum values (that are not listed - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html - http://clang.llvm.org/docs/ClangFormat.html You can assign a shortcut to that command (I personally use `Ctrl+Shift+I` on Windows and `⌘⌥I` on Mac to keep the built-in formatting tool accessible). Go to `Tools > Options... > Environment > Keyboard` and at the very bottom there is the Tools category. Enjoy! :) -
Uflex revised this gist
Feb 7, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111 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. **EDIT**: It seems that there are now official builds for most OSes on the download page: http://llvm.org/releases/download.html ### Configuration -
Uflex revised this gist
Feb 7, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111 ### Installation 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. *EDIT*: It seems that there are now official builds for most OSes on the download page: http://llvm.org/releases/download.html ### Configuration -
Uflex revised this gist
Feb 7, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111 ### Installation 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. *EDIT*: It seems that there are now official builds for most OSes on the download page: http://llvm.org/releases/download.html ### Configuration -
Uflex revised this gist
Oct 23, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,10 +15,10 @@ In QtCreator, add an external tool (Tools > Options... > Environment > External - Working dir: `%{CurrentProject:Path}` (seems to be optional, works without it) - 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) - Input: `%{CurrentDocument:Selection}` If you want to correct the whole file, leave the input field empty, tick the "Modifies current document", set the output to "Show in Pane" and add `-i %{CurrentDocument:FilePath}` to the arguments. See these links for all possible parameters and enum values (that are not listed in the -help option): - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html -
Uflex revised this gist
Oct 23, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ In QtCreator, add an external tool (Tools > Options... > Environment > External - *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}` If you want to correct the whole file, leave the input field empty, set the output to "Show in Pane" and add `-i %{CurrentDocument:FilePath}` to the arguments. See these links for all possible parameters and enum values (that are not listed in the -help option): - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html -
Uflex revised this gist
Oct 23, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ For Windows, download LLVM from http://llvm.org/builds/. You don't need to add i In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool). - Arguments: <blockquote>-style="{BasedOnStyle: llvm, AccessModifierOffset: -4, BreakBeforeBinaryOperators: true, ColumnLimit: 80, Standard: Cpp11, IndentWidth: 4, BreakBeforeBraces: Linux}"</blockquote> - Working dir: `%{CurrentProject:Path}` (seems to be optional, works without it) - Output: replace selection - Error output: show in pane -
Uflex revised this gist
Oct 23, 2013 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ Clang-format in QtCreator ========================= QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111](https://bugreports.qt-project.org/browse/QTCREATORBUG-10111) for a better integration. As of today, you should use it as an external tool, either replacing your selection or the entire file. If you choose to replace the file, you will have to save it before launching the tool and QtCreator will reload the file, making it impossible to undo/redo afterwards. If you choose to replace your selection, you often have to select the whole function, otherwise you will lose the indentation; clang-format doesn't seem to keep the leading spaces. When you run clang-format on your selection, Creator marks the whole selection as changed, even if nothing moved. This is a minor inconvenience and anyway the "Auto-indent Selection" built-in with Creator does the same thing. ### Installation @@ -16,12 +16,14 @@ In QtCreator, add an external tool (Tools > Options... > Environment > External - 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}` If you want to correct the whole file, leave the input field empty and add `-i %{CurrentDocument:FilePath}` to the arguments. See these links for all possible parameters and enum values (that are not listed in the -help option): - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html - http://clang.llvm.org/docs/ClangFormat.html You can assign a shortcut to that command (I personally use `Ctrl+Shift+I` to keep the built-in formatting tool accessible). Go to `Tools > Options... > Environment > Keyboard` and at the very bottom there is the Tools category. Enjoy! :) -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,13 +3,11 @@ Clang-format in QtCreator QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111](https://bugreports.qt-project.org/browse/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. ### Installation 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. ### Configuration In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool). -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,16 @@ Clang-format in QtCreator ========================= QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111](https://bugreports.qt-project.org/browse/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. Installation ------------ 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. Configuration ------------- In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool). - Arguments: <blockquote>-style="{BasedOnStyle: llvm, ColumnLimit: 80, Standard: Cpp11, IndentWidth: 4, BreakBeforeBraces: Linux}"</blockquote> -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,12 +5,16 @@ For Windows, download LLVM from http://llvm.org/builds/. You don't need to add i In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool). - Arguments: <blockquote>-style="{BasedOnStyle: llvm, ColumnLimit: 80, Standard: Cpp11, IndentWidth: 4, BreakBeforeBraces: Linux}"</blockquote> - Working dir: `%{CurrentProject:Path}` (seems to be optional, works without it) - 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): - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html - http://clang.llvm.org/docs/ClangFormat.html You can assign a shortcut to that command (I personally use `ctrl+shift+I` to keep the built-in formatting tool accessible). Go to `Tools > Options... > Environment > Keyboard` and at the very bottom there is the Tools category. Enjoy! :) -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,12 +5,12 @@ For Windows, download LLVM from http://llvm.org/builds/. You don't need to add i In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool). - Arguments: <blockquote>-style="{BasedOnStyle: llvm, ColumnLimit: 80, Standard: Cpp11, IndentWidth: 4, BreakBeforeBraces: Linux}"</blockquote> - 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): - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html - http://clang.llvm.org/docs/ClangFormat.html -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ For Windows, download LLVM from http://llvm.org/builds/. You don't need to add i In QtCreator, add an external tool (Tools > Options... > Environment > External Tools > Add > Add Tool). - Arguments: <blockquote>-style="{BasedOnStyle: llvm, ColumnLimit: 80, Standard: Cpp11, IndentWidth: 4, BreakBeforeBraces: Linux}"</blockquote> - Working dir: %{CurrentProject:Path} - Output: replace selection - Error output: show in pane -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ For Windows, download LLVM from http://llvm.org/builds/. You don't need to add i 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 -
Uflex revised this gist
Oct 21, 2013 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,12 +4,12 @@ For Windows, download LLVM from http://llvm.org/builds/. You don't need to add i 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" - Input: %{CurrentDocument:Selection} See these for all possible parameters: - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html -
Uflex created this gist
Oct 21, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ QtCreator doesn't allow using clang-format by default. Watch [QTCREATORBUG-10111](https://bugreports.qt-project.org/browse/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" Input: %{CurrentDocument:Selection} See these for all possible parameters: - http://clang.llvm.org/doxygen/structclang_1_1format_1_1FormatStyle.html - http://clang.llvm.org/docs/ClangFormat.html