Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-15528

Code Style example does not match what Creator does

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • Qt Creator 3.6.1
    • C/C++/Obj-C++ Support
    • None
    • Windows 7 64 bit

      1. Go to "Tools" -> "Options..." -> "C++" -> "Code Style".
      2. Click "Edit" and go to the "Braces" tab.
        In the code example you'll see something like:
                if (a > 10)
                {
                    int b = 2 * a;
                    return a * b;
                }
        

        Note that the opening brace is on a new line.

      3. Open a source file with the following code:
            if (1 && 2)
                return;
        
      4. Move the cursor into the condition and press Alt+Enter.
      5. Select the quick fix "Split if Statement" and press Enter.
        Creator will replace the code with:
            if (1) {
                if (2)
                    return;
            }
        

        Here, the opening brace is on the same line as the condition.

      Code generated by Creator and the Code Style example should have the same style.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kosjar Nikolai Kosjar
            rlohning Robert Löhning
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes