Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot modify tab settings in Qt Creator

Tags:

c++

qt

qt-creator

I want tab to insert 2 spaces. All other solutions seem to be references an older version of Qt Creator.

Tools -> Options -> Text Editor -> Behaviour -> Tabs and Indentation

No 'Options' option exists in the dropdown menu.

Tools -> Options -> C++ -> Code Styles -> Edit

'Code Styles' does NOT exist in that path.

Qt Creator -> Preferences -> Behavior > Text Editor

This seems to be the appropriate place to modify settings for the whole IDE, but they don't seem to be getting saved to the project.

enter image description here Qt 5.2.1

like image 871
tarabyte Avatar asked Jun 14 '14 18:06

tarabyte


People also ask

How to indent in Qt Creator?

To automatically indent the highlighted text, select Auto-indent Selection or press Ctrl+I. To automatically format the highlighted text, select Auto-format Selection or press Ctrl+;. To adjust the wrapping of the selected paragraph, select Rewrap Paragraph or press Ctrl+E followed by R.

How do I change my Qt theme?

To switch themes, select Edit > Preferences > Environment, and then select a theme in the Theme field. You can use the Qt Creator text and code editors with your favorite color scheme that defines how code elements are highlighted and which background color is used.


1 Answers

There are "Project Settings" that have precedence over the global settings under Tools -> Options -> Text Editor -> ...
These settings can be found in the Projects "UI section" and you have to define a custom "Code Style" for this:

  1. Switch to "Projects" (Ctrl-5)
  2. From the column to the right select "Code Style" (not "Editor") under "Project Settings"
  3. Click "Edit..."
  4. Click "Copy Built-in Code Style"
  5. On the "General" tab adjust tab settings
like image 74
StefanQ Avatar answered Oct 06 '22 10:10

StefanQ