<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am running the latest build of QT Creator 12 on Windows.</p>
<p dir="auto">I would like to use tabs for indentation and spaces for alignment, e.g.</p>
<pre><code>void test(int a,
..........int b,
</code></pre>
<p dir="auto">Instead I get something like:</p>
<pre><code>void test(int a,
\t\t\t....int b
</code></pre>
<p dir="auto">('\t' is tab, '.' is space)</p>
<p dir="auto">Below if a picture that should illustrate the problem I am experiencing, and how I've setup QT Creator.<br />
<img src="https://i.ibb.co/FwLHQQv/qt-creator-alignment-problem.png" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">Cheers,</p>
]]></description><link>https://forum.qt.io/topic/154589/qt-creator-mixed-tabs-spaces-alignment-issue-in-text-editor</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 10:35:49 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/154589.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Feb 2024 14:20:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor on Wed, 21 Feb 2024 09:22:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> I respectfully disagree. It's not what I prefer personally, but there are codebases that enforce the kind of style I'm referring to.</p>
<p dir="auto">It seems like this is not supported or not implemented very well by the Text Editor's own auto-indent.</p>
<p dir="auto">Luckily it is supported by ClangFormat, but you need to disable all the other indentation related shenanigans.</p>
<p dir="auto">Here are the settings that worked for me:</p>
<ol>
<li>Disable <em>Text Editor&gt;Typing&gt;</em> <strong>Enable automatic indentation</strong></li>
<li>Disable <em>Text Editor&gt;Cleanups Upon Saving&gt;</em> <strong>Clean whitespace</strong></li>
<li>(If using FakeVim) Disable <em>FakeVim&gt;General&gt;Vim Behaviour&gt;</em> <strong>Automatic indentation</strong></li>
<li>Enable <em>C++&gt;Code Style&gt;ClangFormat settings&gt;</em> <strong>Format while typing</strong>, and <strong>Format edited code on file save</strong></li>
<li>In <em>C++&gt;Code Style</em>, in the panel named <strong>ClangFormat</strong>, scroll way down and set:<pre><code>UseTab=ForIndentation
</code></pre>
</li>
<li>In that same panel make sure to set <strong>ColumnLimit</strong> to whatever you're using, this does <strong>not</strong> sync with whatever you set up under <em>Text Editor&gt;Display</em>.</li>
</ol>
<p dir="auto">Note that the auto-alignment mostly only "kicks in" when the line you're editing exceeds the maximum column limit. E.g. If you are listing a bunch of arguments, they will always be put on a single line if they fit within the limit. But there's more freedom when it comes to string literals.</p>
<p dir="auto">It does seems to work though, you may have to trigger the alignment/indentation manually by hitting save.</p>
<p dir="auto">Unfortunately, statements using the stream insertion operator mess things up, but from what I gather that's due to a bug in ClangFormat.</p>
]]></description><link>https://forum.qt.io/post/790336</link><guid isPermaLink="true">https://forum.qt.io/post/790336</guid><dc:creator><![CDATA[frejur]]></dc:creator><pubDate>Wed, 21 Feb 2024 09:22:26 GMT</pubDate></item><item><title><![CDATA[Reply to QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor on Wed, 21 Feb 2024 09:23:33 GMT]]></title><description><![CDATA[<p dir="auto"><s>Would love to edit my last reply, but can't due to the 3600s since last edit time restriction... Which should not be applicable since I posted two days ago?</s></p>
<p dir="auto"><strong>UseTab=ForIndentation</strong> seems to be more reliable than <strong>UseTab=AlignWithSpaces</strong></p>
]]></description><link>https://forum.qt.io/post/790658</link><guid isPermaLink="true">https://forum.qt.io/post/790658</guid><dc:creator><![CDATA[frejur]]></dc:creator><pubDate>Wed, 21 Feb 2024 09:23:33 GMT</pubDate></item><item><title><![CDATA[Reply to QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor on Wed, 21 Feb 2024 09:22:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> I respectfully disagree. It's not what I prefer personally, but there are codebases that enforce the kind of style I'm referring to.</p>
<p dir="auto">It seems like this is not supported or not implemented very well by the Text Editor's own auto-indent.</p>
<p dir="auto">Luckily it is supported by ClangFormat, but you need to disable all the other indentation related shenanigans.</p>
<p dir="auto">Here are the settings that worked for me:</p>
<ol>
<li>Disable <em>Text Editor&gt;Typing&gt;</em> <strong>Enable automatic indentation</strong></li>
<li>Disable <em>Text Editor&gt;Cleanups Upon Saving&gt;</em> <strong>Clean whitespace</strong></li>
<li>(If using FakeVim) Disable <em>FakeVim&gt;General&gt;Vim Behaviour&gt;</em> <strong>Automatic indentation</strong></li>
<li>Enable <em>C++&gt;Code Style&gt;ClangFormat settings&gt;</em> <strong>Format while typing</strong>, and <strong>Format edited code on file save</strong></li>
<li>In <em>C++&gt;Code Style</em>, in the panel named <strong>ClangFormat</strong>, scroll way down and set:<pre><code>UseTab=ForIndentation
</code></pre>
</li>
<li>In that same panel make sure to set <strong>ColumnLimit</strong> to whatever you're using, this does <strong>not</strong> sync with whatever you set up under <em>Text Editor&gt;Display</em>.</li>
</ol>
<p dir="auto">Note that the auto-alignment mostly only "kicks in" when the line you're editing exceeds the maximum column limit. E.g. If you are listing a bunch of arguments, they will always be put on a single line if they fit within the limit. But there's more freedom when it comes to string literals.</p>
<p dir="auto">It does seems to work though, you may have to trigger the alignment/indentation manually by hitting save.</p>
<p dir="auto">Unfortunately, statements using the stream insertion operator mess things up, but from what I gather that's due to a bug in ClangFormat.</p>
]]></description><link>https://forum.qt.io/post/790336</link><guid isPermaLink="true">https://forum.qt.io/post/790336</guid><dc:creator><![CDATA[frejur]]></dc:creator><pubDate>Wed, 21 Feb 2024 09:22:26 GMT</pubDate></item><item><title><![CDATA[Reply to QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor on Fri, 16 Feb 2024 19:19:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/frejur">@<bdi>frejur</bdi></a> hi,</p>
<p dir="auto">Mixing both is usually a bad idea. It will work for you because of the configuration of your editor but as soon as the tab is rendered with a different width, your alignement will be broken.</p>
<p dir="auto">You should rather use one or the other to keep things clean.</p>
]]></description><link>https://forum.qt.io/post/790208</link><guid isPermaLink="true">https://forum.qt.io/post/790208</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 16 Feb 2024 19:19:51 GMT</pubDate></item><item><title><![CDATA[Reply to QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor on Fri, 16 Feb 2024 14:34:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> When I do that I get:</p>
<pre><code>void test(int a,
..........int b) {
....int c = 0;
}
</code></pre>
<p dir="auto">Instead of the desired:</p>
<pre><code>void test(int a,
..........int b) {
\t int c = 0;
}
</code></pre>
<p dir="auto">('\t ' is tab, '.' is space)</p>
]]></description><link>https://forum.qt.io/post/790168</link><guid isPermaLink="true">https://forum.qt.io/post/790168</guid><dc:creator><![CDATA[frejur]]></dc:creator><pubDate>Fri, 16 Feb 2024 14:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to QT Creator, mixed tabs&#x2F;spaces alignment issue in Text Editor on Fri, 16 Feb 2024 14:27:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/frejur">@<bdi>frejur</bdi></a> Change "Tab policy" to "Spaces Only"...</p>
]]></description><link>https://forum.qt.io/post/790166</link><guid isPermaLink="true">https://forum.qt.io/post/790166</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 16 Feb 2024 14:27:52 GMT</pubDate></item></channel></rss>