What is the shortcut to format code in Qt Creator?
I want to format my Qt code via a shortcut in Qt Creator, just like ctrl + shift + F in Eclipse.
But didn't found one in Qt creator options, nor after searching via google.
So, do there has such a shortcut in Qt Creator? If no, then how to format code?
You can at least indent your code in the following way. First, select the portion of code you want to indent (or Ctrl + A, if you want to indent all source code in the current file) and then Ctrl + i.
If you're on a Mac OS X, use Command instead of Ctrl.
First, install clang-format.
If you're on Ubuntu, you can do it with sudo apt-get install clang-format.
Then go to Help -> About plugins, and check Beautifier.
Then restart Qt creator.
Now, go to Tools -> Options -> Environment -> Keyboard and find where it says "Format Current File" in the middle column, then click on it.
And at the bottom of this window click on record, and record the key sequence that you would like to use to format the current file.