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

Using QML components defined in resource files does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.7.0
    • None
    • OS X Sow Leopard, Qt 4.7 2010-08-14.

    Description

      Assume a QML component in a file qml/Bar.qml:

      Item {
         // the contents don't matter in this case
          ....
      }
      

      Assume a QML component in a file qml/Foo.qml that uses Bar:

      Item {
           ...
      
          Bar {
              ...
           }
      }
      

      This is normal component usage and works fine without any special import paths or import statements as long as the two files are in the same directory.

      However, as soon as the two files are added as resources to the application the Bar component can no longer be found, even if the paths are still relative to each other. What I see is more or less (can't copy the exact message here):

      qrc:/qml/Foo.qml: Type Bar unavailable

      or

      qrc:/qml/Foo.qml: Bar is not a type

      If QML files are to be usable as resources this normal "component inclusion" mechanism should be supported. To make the files findable I also tried to do:

      QDeclarativeEngine::addImportPath() with "qrc:/qml" or ":/qml", but this had no effect.

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            chakie Jan Ekholm
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes