Display

To set preferences for how Qt Creator displays code and text in the editor, select Preferences > Text Editor > Display.

Display tab in Text Editor preferences

Setting the margin

In the Margin group, you can turn on a vertical line that marks a column in the editor, which is useful for keeping lines within a certain length.

The following table describes the margin preferences you can set.

PreferenceDescription
Display right margin after columnShow a vertical line after the specified column. The default is column 80.
Tint whole margin areaShade the area beyond the margin. Available when Display right margin after column is selected.
Use context-specific marginUse a different margin if one is available from the current context, such as the column limit configured for the ClangFormat plugin.
Editor content widthSet the percentage of the editor window width used to display text content. The default value, 100%, uses the whole width. At 50%, half of the editor width is used to display content, and the remaining width is split between left and right margins to center the content.

Wrapping text

To wrap long lines to fit the width of the editor, select Enable text wrapping in the Wrapping group. This option is available only when Line spacing is set to 100% in Font & Colors preferences.

Setting display preferences

The following table describes the preferences you can set in the Display group.

PreferenceDescription
Display line numbersShow line numbers in the editor.
Display folding markersShow markers for folding and unfolding blocks of code.
Mark text changesMark lines that you added or modified since the file was opened or last saved.
Visualize whitespaceShow tabs and spaces in the editor.
Center cursor on scrollKeep the cursor vertically centered while scrolling.
Auto-fold first commentAutomatically fold the first comment block in a file, such as a license header.
Highlight search results on the scrollbarMark the locations of search results on the scrollbar.
Animate navigation within fileAnimate the view when you jump to a different location within the same file.
Highlight selectionAdd a colored background and a scrollbar marker to other occurrences of the currently selected text.
Highlight current lineHighlight the line that contains the cursor.
Highlight blocksHighlight the code block enclosed by the braces nearest to the cursor. See also Highlight code blocks.
Animate matching parenthesesAnimate the matching parenthesis, brace, or bracket when the cursor is next to one of them.
Visualize indentShow vertical indent guides.
Highlight matching parenthesesHighlight matching parentheses, braces, and brackets.
Always open links in another splitOpen links, such as links to symbol definitions, in another split view instead of the current one.
Display file encodingShow the text encoding of the current file in the editor status bar.
Display file line endingShow the line ending style of the current file in the editor status bar.
Display tab settingsShow the indentation settings of the current file in the editor status bar.
Enable minimapShow a miniature, zoomed-out overview of the file next to the scrollbar.

Showing line annotations

Line annotations show additional information next to a line, such as the results of code analysis or version control information from git blame, in the editor.

To turn off line annotations, clear Line Annotations in the Line Annotations group.

To select where to show the annotations, use Line Annotations:

  • Next to editor content shows annotations directly after the code on the line.
  • Next to right margin shows annotations aligned with the right margin, or after the code if the line is longer than the margin.
  • Aligned at right side shows annotations aligned at the right side of the editor. This is the default.
  • Between lines shows annotations on their own line, between the lines of code.

See also How to: Configure editors, Configuring editors, Highlight code blocks, Analyzing code, and git blame.