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

Javascript-File-Import in inline component is null

    XMLWordPrintable

Details

    • Linux/Wayland
    • 86039f61b32095cb2e341402438c96178baa0158

    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

        Issue Links

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

          Activity

            People

              fabiankosmale Fabian Kosmale
              moerkb Markus Bader
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes