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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Not Evaluated 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

      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)
          }
      }
      

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes