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

Javascript-File-Import in inline component is null

    XMLWordPrintable

    Details

      Description

      A qml file imports a javascript file like this:

      import 'qrc:/example.js' as E
      

      In that same file, a inline component is defined and instantiated, which uses a function of that js file:

      component MyText : Text {
          text: E.func()
      }
      
      MyText {}
      

      The expectation is that the binding to the text property is (correctly) evaluated when the inline component is instantiated. Instead, an error is thrown:

      TypeError: Cannot call method 'func' of null
      

      I tested on 5.15.3 on Linux only, but I expect the same behaviour on all platforms.

      Please find the attached minimal example to produce this error.

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            moerkb Markus Bader
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes