-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8.3, 6.10.0 Beta1
-
None
-
7d433ad2e (dev), 6aee2b7d1 (6.10), 4006bb120 (6.9), bcbbcd24c (tqtc/lts-6.8), fa306a6e6 (tqtc/lts-6.5)
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.
For Gerrit Dashboard: QTBUG-138158 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
658278,3 | Doc: Mention that qt_add_resources does not compile QML files | dev | qt/qtbase | Status: MERGED | +2 | 0 |
658710,2 | Doc: Mention that qt_add_resources does not compile QML files | 6.10 | qt/qtbase | Status: MERGED | +2 | 0 |
659319,2 | Doc: Mention that qt_add_resources does not compile QML files | 6.9 | qt/qtbase | Status: MERGED | +2 | 0 |
659548,2 | Doc: Mention that qt_add_resources does not compile QML files | tqtc/lts-6.8 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
659939,2 | Doc: Mention that qt_add_resources does not compile QML files | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |