How to configure Qt Creator code completion configuration for else {}
-
Qt Creator 4.8.0
Based on Qt 5.12.0 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)When I type if (condition), I can press return and insert a bracket and it lines up to my liking.
For exampleif (someCondition) { }
But if I type else, code completion thinks I want the open bracket on the same line. Is there a way to configure this? My code ends up like the following, which I then have to edit to my liking.
if (someCondition) { doSomething(); } else { goBackAndEditTheElseDeclaration(); }
-
Hi,
You are likely looking for this part of Qt Creator's documentation.
-
In Code Style under Project Settings, I see the Current settings says Global [proxy: Qt]. The preview shows the following, which is what I want, but is not what happens.
if (i < b) bar(i); else { bar(i); bar(b); }
Again, this is code completion behavior. If I go back to the else line and move the bracket to the next line by typing <Enter> before the bracket, it behaves per settings.
BTW this is new behavior with 4.8.0.
-
In Code Style under Project Settings, I see the Current settings says Global [proxy: Qt]. The preview shows the following, which is what I want, but is not what happens.
if (i < b) bar(i); else { bar(i); bar(b); }
Again, this is code completion behavior. If I go back to the else line and move the bracket to the next line by typing <Enter> before the bracket, it behaves per settings.
BTW this is new behavior with 4.8.0.
@Jeff-Barnes i noticed this new behavior too, but only on Linux so far. I just didnt manage to report a bug so far. In case you want to do: bugreports.qt.io (and please add a link here).
-
@Jeff-Barnes i noticed this new behavior too, but only on Linux so far. I just didnt manage to report a bug so far. In case you want to do: bugreports.qt.io (and please add a link here).
Continued as QTCREATORBUG-21767