Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5, 6.8, 6.10
-
None
-
6e536aba7 (dev), 18f491a19 (dev), 7144c6802 (dev), 92c642cd2 (6.9), 3b8a397e2 (tqtc/lts-6.8)
Description
Example 1
As explained at https://doc.qt.io/qt-6/qtqml-modules-identifiedmodules.html , QML URIs cannot contain dashes/hypens. If we try to use "import My-Module", then
- qmlsc will produce a compilation error ("Main.qml:2:10: error: Expected token `;'")
- Uncompiled QML code will produce a runtime error with the same message
Example 2
C++ class names cannot contain dashes. "MyPlugin" is OK but "My-Plugin" is not.
However, qt6_add_qml_module() currently accepts these illegal inputs:
qt6_add_qml_module(My-Module URI My-Module # <-- Accepted by CMake, but generated module is not importable CLASS_NAME My-Plugin # <-- Accepted by CMake, but the generated C++ code is broken # ... )
Suggestion
CMake should produce an error at configure-time if an invalid input is detected.