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

[Reg 4.8->4.9] QML auto format breaks valid structures

    XMLWordPrintable

Details

    Description

       

      // Imagine we have next var:
      readonly property var model: [{
              "delegate": headerLabelComponent,
              "text": qsTr("Display")
          }, {
              "delegate": scaleSliderDelegate
          }, {
              "delegate": switchDelegateComponent,
              "text": qsTr("Dark theme"),
              "value": theme.style === Theme.Dark,
              "checkedCb": function (checked) {
                  if (checked) {
                      theme.style = Theme.Dark
                      return
                  }
                  theme.style = Theme.Light
              }
          }, {
              "delegate": headerLabelComponent,
              "text": qsTr("Additional")
          }, {
              "delegate": itemDelegateComponent,
              "text": qsTr("emergency call"),
              "onClicked": function () {
                  Qt.openUrlExternally('tel:112')
              }
          }]
      

      After saving file with such variable formatter deletes all array items and left me with:

      readonly property var model: [, , , , ]
      

      Seems like critical bug to me

      Attachments

        Issue Links

          For Gerrit Dashboard: QTCREATORBUG-22026
          # Subject Branch Project Status CR V

          Activity

            People

              thohartm Thomas Hartmann
              alexeym A M
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes