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

Imported scripts can't reference each other

    XMLWordPrintable

Details

    Description

      If I have a QML file like:

      import Qt 4.7
      import "a.js" as A
      import "b.js" as B
      Item {
      }

      and a.js looks like:

      .pragma library
      var foo = "foo";

      and b.js looks like:

      .pragma library
      console.log(foo);

      I get undefined printed from b.js when running the QML file. By changing b.js to:

      .pragma library
      console.log(A.foo);

      I get:

      TypeError: Result of expression 'A' [undefined] is not an object.

      I would expect that there would be some way for imported JS files to reference each other.

      Attachments

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

        Activity

          People

            dajansen Damian Jansen (closed Nokia identity) (Inactive)
            virantal Ville Rantala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes