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

QML formatter breaks signal handlers written in "arrow function expression"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Fixed
    • Affects Version/s: Qt Creator 5.0.0, Qt Creator 5.0.1, Qt Creator 6.0.0, Qt Creator 6.0.1
    • Fix Version/s: Qt Creator 7.0.0-beta2
    • Component/s: Quick / QML Support
    • Labels:
      None

      Description

      The QML formatter in QtCreator failed to format the following qml content:

      import QtQuick
      
      Item {
          onDataChanged: (data) => { // Notice the "(data) =>" arrow function expression
              if (someCondition)
                  console.log("function called")
              doSomethingElse()
          }
      }
      

       

      However, the signal handler written in the following format passes the formatter.

      import QtQuick
      
      Item {
          onDataChanged: function (data) {
              if (someCondition)
                  console.log("condition matched")
              doSomethingElseWithData(data)
          }
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            fawzi Fawzi Mohamed
            Reporter:
            leroy Haoyu Liu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes