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

module import is ambiguous

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.0.0 Beta 1, 5.2.0 Beta1
    • None
    • Ubuntu 12.04 Precise, Qt5 Beta1

    Description

      When qmldir contains QML elements, plugin library and JavaScript libraries, the QML elements of the module cannot access the elements exported by the plugin library. If JavaScript files are removed, the module QML elements need to import the module URL still.

      qmldir:

      module com.module
      plugin testplugin
      TestItem 0.1 TestItem.qml
      JSLibrary 0.1 JSLibrary.js
      

      TestItem.qml:

      import QtQuick 2.0
      import com.module 0.1 // this is not working
      
      TestElement {
          // this element is exported by testplugin
      }
      

      If the "import com.module 0.1" is missing, the TestElement type is not known. If it is there, or import "." 0.1 is used, the "com.module 0.1 is ambiguous" error is reported.

      Workaround: use named import. Works, but it is annoying.
      TestItem.qml:

      import QtQuick 2.0
      import com.module 0.1 as Privates
      
      Privates.TestElement {
         // the element exported by the library
      }
      

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jombi Zsombor Egri
            Votes:
            7 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes