<?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 C++ Indentation Problems]]></title><description><![CDATA[<p dir="auto">Qt 6.7.1; QtCreator 14.0.1 on Windows 10</p>
<p dir="auto">Hi,<br />
In order to fix a breakage when running Android apps after a Qt upgrade, I have recently cleared out Qt caches in AppData/Local and AppData/Roaming, as well as removing the original build directories.</p>
<p dir="auto">This fixed the problem but I am left with Qt default formatting options for the C++ code, which I really can't use. I want to customise code indentation, specifically to indent all blocks with 4 spaces. So:</p>
<pre><code>namespace foo
{
    namespace bar
    {
        class Baz
        {
        };
    }
}
</code></pre>
<p dir="auto">instead of</p>
<pre><code>namespace foo
{
namespace bar
{
class Baz
{
};
}
}
</code></pre>
<p dir="auto">and so on, with TAB meaning "indent leading whitespace only" and without ther aggressive auto-formatting enabled.<br />
There are several more options I would like to set, but these are the main ones.</p>
<p dir="auto">I just can't find any way to set Edit-&gt;Preferences-&gt;C++-&gt;Code Style to do this.</p>
<p dir="auto">I have struggled with this in the past and somehow managed to find an acceptable solution, but one evades me now.<br />
Any help with this would be greatly appreciated.</p>
]]></description><link>https://forum.qt.io/topic/158466/qt-creator-c-indentation-problems</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2026 09:04:40 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/158466.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Aug 2024 16:10:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt Creator C++ Indentation Problems on Thu, 29 Aug 2024 16:39:53 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, yes, I have copied the preset. It was the hunt through the various properties I was failing at.<br />
The one I need is "NamespaceIndentation", unsurprisingly, but I was assuming the value it took was the number of spaces. It should be the string "All".</p>
]]></description><link>https://forum.qt.io/post/808349</link><guid isPermaLink="true">https://forum.qt.io/post/808349</guid><dc:creator><![CDATA[KenAppleby 0]]></dc:creator><pubDate>Thu, 29 Aug 2024 16:39:53 GMT</pubDate></item><item><title><![CDATA[Reply to Qt Creator C++ Indentation Problems on Thu, 29 Aug 2024 16:26:48 GMT]]></title><description><![CDATA[<p dir="auto">I think you need to first <strong>copy</strong> an existing preset and then it will allow you to modify it.</p>
<p dir="auto">In Qt Creator 14 you can also select different preset per-project. When you have a project open, look in Projects-&gt;Code Style.</p>
]]></description><link>https://forum.qt.io/post/808348</link><guid isPermaLink="true">https://forum.qt.io/post/808348</guid><dc:creator><![CDATA[sierdzio]]></dc:creator><pubDate>Thu, 29 Aug 2024 16:26:48 GMT</pubDate></item></channel></rss>