Behavior
To set indentation preferences for text files that do not have C++ or QML code (such as Python code files), select Preferences > Text Editor > Behavior.

You can set how to interpret the Tab and Backspace key presses and how to align continuation lines.
Setting tab preferences
You can set tab preferences at the following levels:
- For all C++ files
- For all QML files
- For all other text files
- For C++ files in a project
- For QML files in a project
- For other text files in a project
Setting tabs and indentation
You can set tab policy and tab size in the Tabs and Indentation group. In the Default Tab policy field, select whether to use only spaces or only tabs for indentation, or to use a mixture of them.
By default, the tab length in code editor is 8 spaces and the indent size is 4 spaces. You can set the tab length and indent size separately for each project and for different types of files.
You can have continuation lines aligned with the previous line. In the Align continuation lines field, select Not at all to disable automatic alignment and indent continuation lines to the logical depth. To always use spaces for alignment, select With Spaces. To follow the Tab policy, select With Regular Indent.
Setting typing preferences
When you type text or code, it is indented automatically according to the selected text editor or code style preferences. To set typing preferences, select Preferences > Text Editor > Behavior > Typing.
The following table describes the typing preferences you can set.
| Preference | Description |
|---|---|
| Enable automatic indentation | Automatically indent new lines according to the text editor or code style preferences. |
| Backspace indentation | set how the indentation is decreased when you select Backspace:
|
| Tab key performs auto-indent | set when the Tab key automatically indents text:
|
| Prefer single line comments | When your highlight definition file has definitions for both multi and single line comments, select this option to apply the single line comment definition when commenting out a selection. |
| Preferred comment position | Set the position of single line comments when you comment out a selection:
|
Cleaning up whitespace upon saving
To automatically clean up whitespace each time you save a file, select Preferences > Text Editor > Behavior, and go to Cleanups Upon Saving.
The following table describes the cleanup preferences you can set.
| Preference | Description |
|---|---|
| Clean whitespace | Remove trailing whitespace upon saving. |
| In entire document | Clean whitespace in the entire document instead of only in the parts that you changed. Available when Clean whitespace is selected. |
| Clean indentation | Correct leading whitespace according to the tab settings. Available when Clean whitespace is selected. |
| Skip clean whitespace for file types | List wildcard-aware file patterns, separated by commas or semicolons, for which trailing whitespace is not trimmed. By default, *.md, *.MD, Makefile are skipped. Available when Clean whitespace is selected. |
| Ensure newline at end of file | Always write a newline character at the end of the file. |
Setting file encoding preferences
To set the default text encoding, byte order mark (BOM), and line ending style used when creating or saving files, select Preferences > Text Editor > Behavior, and go to File Encodings.
The following table describes the file encoding preferences you can set.
| Preference | Description |
|---|---|
| Default encoding | Select the text encoding to use for new files and for files whose encoding cannot be detected automatically. |
| UTF-8 BOM | Set how to handle UTF-8 byte order marks:
UTF-8 BOMs are uncommon and are treated incorrectly by some editors, so it usually makes little sense to add one. This setting does not affect the use of UTF-16 and UTF-32 BOMs. |
| Default line endings | Select Unix (LF) or Windows (CRLF) as the default line ending style for new files. |
Setting mouse and keyboard preferences
To set preferences for using the mouse and keyboard in the text editor, select Preferences > Text Editor > Behavior, and go to Mouse and Keyboard.
The following table describes the mouse and keyboard preferences you can set.
| Preference | Description |
|---|---|
| Hide mouse cursor while typing | Hide the mouse cursor while you type. Not available on macOS. |
| Enable mouse navigation | Use the mouse to navigate in the editor, for example, to follow links with Ctrl+click (or Cmd+click on macOS). |
| Enable scroll wheel zooming | Zoom the text in the editor by holding Ctrl while rotating the mouse wheel. |
| Enable built-in camel case navigation | Move within camelCase and snake_case names one hump or word part at a time when using cursor navigation and selection. |
| Enable smart selection changing | Make Select Block Up and Select Block Down provide smarter selections. |
| Show help tooltips using keyboard shortcut (Alt) | Show context-sensitive help or type information as a tooltip when you press Alt. |
| Show help tooltips using the mouse | Select On Mouseover to show context-sensitive help or type information on mouseover, or On Shift+Mouseover to show it only when you press Shift while hovering. |
See also How to: Configure editors, Find preferences, Indent text or code, Specify Qt Quick code style, Configuring editors, C++ code style, and Nim.