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.
Attachments
For Gerrit Dashboard: QTBUG-135860 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
639690,1 | Check CLASS_NAME at configure time | dev | qt/qtdeclarative | Status: NEW | 0 | +1 |
640314,8 | Ensure that plugin class name is a valid C indentifier | dev | qt/qtbase | Status: MERGED | +2 | 0 |
641646,3 | Add the missing CLASS_NAME to the qt_add_plugin calls | dev | qt/qtapplicationmanager | Status: MERGED | +2 | 0 |
641651,2 | Do not punish users for using dashes in plugin target names | dev | qt/qtbase | Status: MERGED | +2 | -1 |
641868,2 | Add the missing CLASS_NAME to the qt_add_plugin calls | 6.9 | qt/qtapplicationmanager | Status: MERGED | +2 | 0 |
642100,2 | Add the missing CLASS_NAME to the qt_add_plugin calls | tqtc/lts-6.8 | qt/tqtc-qtapplicationmanager | Status: MERGED | +2 | 0 |