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

QML auto format rewrites computed property names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • Qt Creator 10.0.0
    • Quick / QML Support
    • All

      Context: there exists a very useful feature in javascript called computed property names, this appears to be supported in Qt QML.

      The following example won't run, but it does demonstrate the problem

      ```QML

      // Example usage

      Item {
          property var exampleMapping: (

      {         [someObject.property]: "I am an example",         // ...     }

      )
      }

      // after auto formatting:
      Item {
          property var exampleMapping: (

      {         "someObject.property": "I am an example",         // ...     }

      )
      }

      ```

      The auto-formatter is incorrectly changing the property to a string. Equally if you just use a local variable the formatter will replace the computed property with a string

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

            semih.yavuz Semih Yavuz
            jack_bromley Jack Bromley
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes