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.