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

Inline Components can not access imported Javascript module

    XMLWordPrintable

Details

    • All

    Description

      Consider this codefile `Test.qml`: 

      import QtQuick 2.15
      
      import MyModule 0.1
      
      Item {
      
          component InlineCmpt: Text { text: JSMod.formatText("does not work") }
      
          InlineCmpt {}
      
          Text { text: JSMod.formatText("works") }
      }
      

      MyModule is a QML module that defines a javascript module JSMod.

      JSMod contains a function `formatText` that I want to use inside my inline component.

      This code fails at runtime with the message that JSMod is undefined inside `InlineCmpt`

      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
            skaldesh Sebastian Borchers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes