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

QML auto format rewrites computed property names

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 10.0.0
    • Quick / QML Support
    • None
    • All

    Description

      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

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes