Indenting CodeWhen you type code, it is indented automatically according to the selected text editor and code style options. Select a block to indent it when you press Tab. Press Shift+Tab to decrease the indentation. You can disable automatic indentation. When you press Backspace, the indentation is decreased by one level in leading white space, by default. You can disable this setting. Continuation lines are aligned with the previous line by using spaces. You can disable automatic alignment to have them indented to the logical depth. You can always use spaces for alignment or use spaces or tabs depending on the other options you selected. You can specify indentation either globally for all files or separately for:
You can specify indentation either globally for all files of a particular type or separately for each project. Indenting Text FilesTo specify global indentation settings for the text editor, select Tools > Options... > Text Editor > Behavior. You can also use these settings globally for all editors and files. To specify settings for a particular project, select Projects > Editor Settings. Indenting C++ FilesTo specify global indentation settings for the C++ editor, select Tools > Options... > C++. To specify the settings for a particular project, select Projects > Code Style Settings. You can specify how to:
You can use the live preview to see how the options change the indentation. Indenting QML FilesTo specify global settings for the Qt Quick editor, select Tools > Options... > Qt Quick. To specify the settings for a particular project, select Projects > Code Style Settings. You can specify how to interpret the Tab and Backspace key presses. Specifying Tab SettingsYou can specify tab settings at the following levels:
By default, the tab-length in code editor is 8 spaces. You can specify the tab length separately for each project and for different types of files. The code editor can also determine whether tabs or spaces are used on the previous or next line and copy the style. The Tab key can automatically indent text when you press it, or only when the cursor is located within leading white space. Specifying Settings for ContentYou can indent public, protected, and private statements and declarations related to them within classes. You can also indent statements within methods and blocks and declarations within namespaces. You can indent class, namespace, enum and method declarations and code blocks. You can indent case or default statements, or statements or blocks related to them within switch statements. To align continuation lines to tokens after assignments, such as = or +=, select the Align after assignments check box. You can specify additional settings for aligning continuation lines in the General tab. You can also add spaces to conditional statements, so that they are not aligned with the following line. Usually, this only affects if statements. [Previous: Completing Code] [Next: Finding and Replacing] © 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia. Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. X
|