Solved QT Creator doesn't automatically add the closing curly bracket after while, for and if statements.
-
I've been tinkering with qt creator and I've been liking it so far but it seems I must've missed the setting which enables this feature which is included in every other IDE out there by default.
Essentially after an if, else if, for or while statement's condition, I press enter and automatically indents and after inserting the left curly bracket it doesn't automatically add the right one. Is it possible to enable a setting to automatically add the second one? Thank you in advance!
-
@Diluc said in QT Creator doesn't automatically add the closing curly bracket after while, for and if statements.:
feature which is included in every other IDE out there by default.
after inserting the right curly bracket it doesn't automatically add the left one.
Speak for yourself! I have not used an IDE which inserts a left brace after I type a right one. And I have used a few. Qt Creator does add a right brace after I type a left one.....
-
@JonB Oops, I mixed them up, I meant the opposite. It does add it when defining methods, functions and classes but not after the conditions of while, for and if statements.
-
@Diluc
For me it does (for all cases), and (so far as I know) I have not changed whatever the defaults are. I'll have to leave someone else to point you to where this might be controllable, because I can't see it.... -
Hi @Diluc,
the closing brace is inserted after you write the opening brace and press Enter.
I think that is the result of a bugreport from me, because often enough I need to add some
if ()
around an existing block and in that case the closing brace is contraproductive on the same line asif
(it's needed more lines downwards).I think the same mechanism was used for functions also in former times, but unbalanced braces bring the Clang Code Model to its limits, therefore Creator tries to keep them symmetric here.
Regards
-
@aha_1980 oh, it was that simple, huh. Thank you a lot for clarifying!
-
Hi @Diluc,
so please mark this topic as SOLVED now (button Topic Tools below your first post).
Thanks!