- Qt Creator Manual
- Specify code style
- Qt Creator Manual 12.0.1

How To

# Specify code style

The MIME type of the file determines which mode and editor the file opens in. Qt Creator opens C++ files in Edit mode in the C++ code editor and QML files in the Qt Quick editor.

You can specify indentation for:

- C++ files
- QML files
- Nim files
- Other text files

You can specify code style either globally or separately for each project. You can specify several sets of code style settings and easily switch between them. In addition, you can import and export code style settings.

To override the global code style for the current project:

1. Select Projects > Project Settings > Code Style.

2. In the Language field, select C++, Qt Quick, or Nim.
3. Deselect the Use global settings check box.
4. In the Current settings field, select the settings to modify and click Copy.
5. Give a name to the settings and click OK.
6. Click Edit to specify a code style for the project.

In rare cases, ClangFormat can trip over a code construct and trigger a Qt Creator crash. If that happens for your project, select Disable as the formatting mode to switch ClangFormat off for the project. If you can reproduce the crash, please select Help > Report Bug to report the bug and and attach the code that triggers the crash.

See also Indent text or code, C++ Code Style, Qt Quick Code Style, and Nim.

How To