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

qmllint: unqualified access to javascript submodule

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 6.0 (Next Major Release)
    • Fix Version/s: 6.1
    • Component/s: QML: Tooling
    • Commits:
      a29eb1c15200363a175c1b3a9ad2189b63b9765f (qt/qtdeclarative/dev)

      Description

      For simple project bellow qmllint (build from dev branch) reports,

      Warning: unqualified access at main.qml:14:20
                  return Foo.f("User");
                         ^^^
      
      

      what is rather strange, for .qml object imported in similar way all fine,
      but javascript for some reason is bad.
      I also tried syntax like:

      import "Foo.js" as Foo
      

      and it partly works. It works for file system access to qml + javascript code,
      but for real program code with "qrc:/" as prefix it reports the same unqualified access.

      qmlscene handle the first variant just fine.

      //$ cat main.qml 
      import QtQuick 2.15
      import QtQuick.Window 2.15
      import MyModule 1.0
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Text {
              anchors.centerIn: parent
              text: {
                  return Foo.f("User");
              }
          }
      }
      
      
      //$ cat MyModule/qmldir 
      module MyModule
      Foo 1.0 Foo.js
      
      //$ cat MyModule/Foo.js
      .pragma library
      
      function f(name) {
          return "Hi, " + name
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            evgeniy_dushistov evgeniy_dushistov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes