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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • Qt Creator 7.0.0-beta2
    • Qt Creator 5.0.0, Qt Creator 5.0.1, Qt Creator 6.0.0, Qt Creator 6.0.1
    • Quick / QML Support
    • 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

            fawzi Fawzi Mohamed
            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