Search code examples
qtcoding-styleideqt-creatorindentation

Qt Creator indentation changes at save


I'm using Qt Creator and I'm willing to create my own coding style.

The only thing I changed in the default Qt [built-in] settings is changed "Tab policy" to "Tabs Only" and "Align continuation lines" to "With regular indent". "Tab size" and "Indent size" are both set to 4.

And I get the following indentation:

int function( int param1 )
{
<  t  >if(  param != 0 &&
<  t  >< s >param != 1 )
<  t  >{
<  t  ><  t  >//do something
<  t  >}
}

< t > is for tabs and < s > is for spaces.

The problem is that when I save (Ctrl+S) Qt Creator converts spaces into tabs. How can I set it not to convert anything and not change the indentation when saving?


Solution

  • Take a look here:

    Tools > Options > Text Editor > Behavior
    cleanups upon saving section
    

    Or if you want for current project only (change qt creator version in path)

    http://doc.qt.io/qtcreator/creator-editor-settings.html