Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120580

Type annotation is not allowed in signal handler

    XMLWordPrintable

Details

    Description

      import QtQuick
      Window {
          onWidthChanged: function(): void{ console.log(width) } // error
          function fn(): void { }
      } 

      In the above code, it seems that type annotation in the signal handler of onWidthChanged is not allowed.

      Error compiling qml file: .../Main.qml:4:31: error: Type annotations are not permitted for the return value of JavaScript functions
      

      However, as far as I know, QML allows type annotation and utilizes it for optimzation like the function `fn()`.

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            bylee Byoung-young Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes