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

QML JavaScript function annotations not supported

    XMLWordPrintable

Details

    Description

      The docs say:

      Function declarations in QML documents can, and should, contain type annotations.

      https://doc.qt.io/qt-6/qtqml-javascript-hostenvironment.html#type-annotations-and-assertions

      But QML using annotations fails to parse:

      import QtQuick
      import QtWebEngine
      
      WebEngineView {
          id: webView
          url: "https://www.qt.io"
      
          onAudioMutedChanged: function (muted: bool) {}
      }
      
      $ qml /tmp/web.qml
      QQmlApplicationEngine failed to load component
      [file:///tmp/web.qml:8:41:] Type annotations are not permitted in function parameters in JavaScript functions
      qml: Did not load any objects, exiting.
      

      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
            rectalogic Andrew Wason
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes