Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
6.8.3, 6.10.0 Beta1
-
None
Description
Components become invisible to the QML engine when applying QT_DISCARD_FILE_CONTENTS option to the QML source files:
set_source_files_properties( main.qml PROPERTIES QT_DISCARD_FILE_CONTENTS TRUE ) qt_add_resources(appmulti-module "main_qml" PREFIX "/" FILES main.qml )
Running the application ends up with an error:
QQmlApplicationEngine failed to load component qrc:/main.qml: File is empty
Since Qt 6.10, qt_add_resources() introduces the new option DISCARD_FILE_CONTENTS, which does not work either.
This issue does not occur when using qt_add_qml_module() function with the DISCARD_QML_CONTENTS option. But if we define multiple QML modules in a single CMakeLists.txt, there will be a similar problem.
The attachment contains a minimum reproduce project.
Attachments
For Gerrit Dashboard: QTBUG-138158 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
658278,2 | Doc: Mention that qt_add_resources does not compile QML files | dev | qt/qtbase | Status: NEW | +2 | 0 |