Reputation: 1445
How can I prevent Qt Creator 2.4.1 from replacing tabs with spaces?
I have chosen ‘Tabs only’ on ‘Tab policy’ but Qt Creator still has this annoying behaviour
Upvotes: 7
Views: 4583
Reputation: 8419
Solution for Qt Creator 15.0.1:
Go to Edit
->Preferences
->C++
. In the Code Style
tab activate Use custom settings
.
A bit lower, in the Clang Format
tab, in the editable text field with the line numbers, go to UseTab
(line 268 in my case) and instead of Never
, manually write Always
.
Click Ok
and reformat the code.
Upvotes: 0
Reputation: 3117
In Qt Creator 13.0.0 (and some earlier version I think), there is no "Edit" button in the C++ tab.
So in the C++ tab, in "ClangFormat settings", select "Formatting mode: Use built-in indenter". Then you can change the tab settings below, in the "General" tab of the "Custom settings".
Upvotes: 1
Reputation: 358
3 years later the issue is still there but ... in QT5.9.1 - qt-creator go to Tools - Options - Fakevim and click on the button "set Qt Style" and the problem is gone (at least for Makefile(s))
Upvotes: 3
Reputation: 12600
In settings, go to C++
, and on the Code Style
tab, press the Edit
button.
In the new window, you will have a General Tab
which allows for C++-specific code indentation settings.
Set Tab policy
to Tabs only
and Align continuation lines
(if 2.4.1 already had that, not sure) to With Regular Indent
and you should be good.
Note: The same can be done for Qt Quick
.
Upvotes: 10