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?

Answers


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.


  1. First, install clang-format.

    If you're on Ubuntu, you can do it with sudo apt-get install clang-format.

  2. Then go to Help -> About plugins, and check Beautifier.

  3. Then restart Qt creator.

  4. 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.


Need Your Help

Simple post to Web Api

c# asp.net-mvc-4 asp.net-web-api http-post

I'm trying to get a post request to work with the web api. Following is my api controller.

sql delete statement where date is greater than 30 days

sql-server date-arithmetic

I wish to find a SQL statement that when executed deletes fields that are older then 30 days.