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 3 Dec 2020, 12:42 last edited by Diluc 12 Mar 2020, 13:05
    #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!

    J 1 Reply Last reply 3 Dec 2020, 13:04
    0
    • D Diluc
      3 Dec 2020, 12:42

      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!

      J Online
      J Online
      JonB
      wrote on 3 Dec 2020, 13:04 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 3 Dec 2020, 13:06
      2
      • J JonB
        3 Dec 2020, 13:04

        @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 3 Dec 2020, 13:06 last edited by Diluc 12 Mar 2020, 13:07
        #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.

        J A 2 Replies Last reply 3 Dec 2020, 13:13
        0
        • D Diluc
          3 Dec 2020, 13:06

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

          J Online
          J Online
          JonB
          wrote on 3 Dec 2020, 13:13 last edited by JonB 12 Mar 2020, 13:13
          #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
            3 Dec 2020, 13:06

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

            A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 3 Dec 2020, 13:39 last edited by aha_1980 12 Mar 2020, 13:39
            #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 3 Dec 2020, 13:44
            4
            • A aha_1980
              3 Dec 2020, 13:39

              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 3 Dec 2020, 13:44 last edited by
              #6

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

              A 1 Reply Last reply 3 Dec 2020, 13:50
              1
              • D Diluc
                3 Dec 2020, 13:44

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

                A Offline
                A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on 3 Dec 2020, 13:50 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

                1/7

                3 Dec 2020, 12:42

                • Login

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