Doc: Describe code indentation options

- Describe the related menu options in Edit > Advanced
- Describe showing (context-sensitive) right margin in editor

Task-number: QTCREATORBUG-25642
Change-Id: I6377488d2417faedb58ae7dce65158b7d62c3f9d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Leena Miettinen
2021-06-29 15:33:01 +02:00
parent 6f5d78a297
commit 79ca424782
4 changed files with 41 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -48,6 +48,29 @@
\li Other text files \li Other text files
\endlist \endlist
To fix the indentation in the file currently open in the editor,
select options in the \uicontrol Edit > \uicontrol Advanced menu
or use \l{Keyboard Shortcuts}{keyboard shortcuts}:
\list
\li To automatically indent the highlighted text, select
\uicontrol {Auto-indent Selection} or press \key {Ctrl+I}.
\li To automatically format the highlighted text, select
\uicontrol {Auto-format Selection} or press \key {Ctrl+;}.
\li To adjust the wrapping of the selected paragraph, select
\uicontrol {Rewrap Paragraph} or press \key {Ctrl+E}
followed by \key R.
\li To toggle text wrapping, select \uicontrol {Enable Text Wrapping}
or press \key {Ctrl+E} followed by \key {Ctrl+W}.
\li To visualize whitespace in the editor, select
\uicontrol {Visualize Whitespace} or press \key {Ctrl+E}
followed by \key {Ctrl+V}.
\li To clear all whitespace characters from the currently open file,
select \uicontrol {Clean Whitespace}.
\endlist
\section1 Specifying Indentation Settings
You can also specify indentation separately for each project. You can You can also specify indentation separately for each project. You can
specify several sets of code style settings and easily switch between them. specify several sets of code style settings and easily switch between them.
In addition, you can import and export code style settings. In addition, you can import and export code style settings.
@@ -61,7 +84,20 @@
\image qtcreator-options-text-editor-behavior.png "Text Editor Behavior options" \image qtcreator-options-text-editor-behavior.png "Text Editor Behavior options"
To visualize whitespace in the editor, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Text Editor} > \uicontrol Display >
\uicontrol {Visualize whitespace}.
\image qtcreator-options-text-editor-display.png "Text Editor Display options"
To help you keep line length at a particular number of characters, set the
number of characters in the \uicontrol {Display right margin at column}
field. To use a context-specific margin when available, select the
\uicontrol {Use context-specific margin} check box.
\if defined(qtcreator) \if defined(qtcreator)
For example, the margin could be set by the \c ColumnLimit option of the
\l{Specifying Code Style Settings}{Clang Format plugin}.
\section1 Indenting C++ Files \section1 Indenting C++ Files
To specify indentation settings for the C++ editor: To specify indentation settings for the C++ editor:

View File

@@ -101,6 +101,8 @@
\uicontrol {Text Editor} > \uicontrol Display > \uicontrol {Text Editor} > \uicontrol Display >
\uicontrol {Display folding markers}. This option is enabled by default. \uicontrol {Display folding markers}. This option is enabled by default.
\image qtcreator-options-text-editor-display.png "Text Editor Display options"
When the cursor is on a brace, the matching brace is animated by default. To When the cursor is on a brace, the matching brace is animated by default. To
turn off the animation and just highlight the block and the braces, select turn off the animation and just highlight the block and the braces, select
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} > \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
@@ -117,4 +119,6 @@
\key {Ctrl+Alt+Shift+U}. To enable smart block selection, select \key {Ctrl+Alt+Shift+U}. To enable smart block selection, select
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} > \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Behavior > \uicontrol {Enable smart selection changing}. \uicontrol Behavior > \uicontrol {Enable smart selection changing}.
\image qtcreator-options-text-editor-behavior.png "Text Editor Behavior options"
*/ */