Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the shortcut to format code in Qt Creator?

Tags:

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?

like image 306
user218867 Avatar asked Jun 02 '16 16:06

user218867


People also ask

What is the shortcut to format code?

VSCode – Code Formatting ShortcutsOn Windows Shift + Alt + F. On macOS Shift + Option + F. On Linux Ctrl + Shift + I.

How do I create a shortcut in Qt?

The simplest way to create a shortcut for a particular widget is to construct the shortcut with a key sequence. For example: shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")), parent); When the user types the key sequence for a given shortcut, the shortcut's activated() signal is emitted.

Is Qt Creator a good IDE?

QtCreator is stable enough and a comfortable IDE, although compile/debug cycles are slower on Windows than with Visual Studio. It doesn't have all the fancy features Visual Studio offers, but after using it for a while I just realized I wasn't missing them.


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

like image 53
Szymson Avatar answered Oct 01 '22 04:10

Szymson