Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT Creator doesn't automatically add the closing curly bracket after while, for and if statements.
Forum Updated to NodeBB v4.3 + New Features

QT Creator doesn't automatically add the closing curly bracket after while, for and if statements.

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Diluc
    wrote on last edited by Diluc
    #1

    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!

    JonBJ 1 Reply Last reply
    0
    • D Diluc

      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!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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.....

      D 1 Reply Last reply
      2
      • JonBJ JonB

        @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.....

        D Offline
        D Offline
        Diluc
        wrote on last edited by Diluc
        #3

        @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.

        JonBJ aha_1980A 2 Replies Last reply
        0
        • D Diluc

          @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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @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....

          1 Reply Last reply
          1
          • D Diluc

            @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.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by aha_1980
            #5

            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 as if (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

            Qt has to stay free or it will die.

            D 1 Reply Last reply
            4
            • aha_1980A aha_1980

              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 as if (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

              D Offline
              D Offline
              Diluc
              wrote on last edited by
              #6

              @aha_1980 oh, it was that simple, huh. Thank you a lot for clarifying!

              aha_1980A 1 Reply Last reply
              1
              • D Diluc

                @aha_1980 oh, it was that simple, huh. Thank you a lot for clarifying!

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi @Diluc,

                so please mark this topic as SOLVED now (button Topic Tools below your first post).

                Thanks!

                Qt has to stay free or it will die.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved