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

Same name QML files lead to "No module name xxx found" error

    XMLWordPrintable

Details

    • Windows

    Description

      A bit background which can be skipped. I faced a problem migrating my existent application from Qt 5.15+qmake to Qt 6.5.1+cmake. I have one Qt Quick application. All qml code is baked into qrc file and then compiled into final binary executable. So at first I used the same approach with qrc file and everything works. Then tried to do everything properly as suggested in the docs. And faced the following problem.

      The problem is that I have same QML file names in different subfolders. For example multiple pages UI and different pages contain similar components like LeftBar.qml. And when I add these files using qt_add_qml_module then I cannot load this module via QQmlApplicationEngine::loadFromModule. I get error:

      QQmlApplicationEngine failed to load component
      <Unknown File>: No module named "qml_same_names" found

      The full workable example you can find on github. I just created simple Qt Quick app and added two files with same names.

      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
            limentas Sergey Lebedev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes