SUMMARY The name of the types exported to QML shall start with upper case letter, see: http://doc.qt.io/ qt-5/qtqml-typesystem-objecttypes.html "... the type name must begin with an uppercase letter in order to be declared as a QML object type in a QML file." It would be useful if the clazy would catch these errors and optionally would offer a quickfix. I have wasted 3 evenings on debugging such an issue and I was not the only one who faced similar issue. STEPS TO REPRODUCE 1. Create a QML plugin with the QtCreator's Qt Quick 2 Extension project wizard and select a lower case Class name 2. Ensure that the generated qmlRegisterType<asdasd>(uri, 1, 0, "asdasd"); exports with lower case 3. Run clazy OBSERVED RESULT clazy did not reports any error EXPECTED RESULT clazy should report error SOFTWARE/OS VERSIONS Windows: all MacOS: all Linux/KDE Plasma: all (available in About System) KDE Plasma Version: n/a KDE Frameworks Version: n/a Qt Version: n/a ADDITIONAL INFORMATION Fix for the QtCreator's wizard is on it's way: https://codereview.qt-project.org/#/c/245440/ With some guidance I can came up with a patch to clazy as well.
good idea
Thinking this should be implemented in Qt instead, with a static-assert
Git commit 90ef5de73c8cb09eda1480a4930450e243abe6de by Sergio Martins. Committed on 18/11/2018 at 19:58. Pushed by smartins into branch 'master'. New check: lowercase-qml-type-name Warns when QML types registered with qmlRegisterType() or qmlRegisterUncreatableType() don't start with uppercase. It's required by the engine. M +1 -0 Changelog M +1 -0 CheckSources.cmake M +1 -0 README.md M +6 -1 checks.json A +4 -0 docs/checks/README-lowercase-qml-type-name.md M +1 -0 readmes.cmake M +2 -0 src/Checks.h A +69 -0 src/checks/level0/lowercase-qml-type-name.cpp [License: LGPL (v2+)] A +38 -0 src/checks/level0/lowercase-qml-type-name.h [License: LGPL (v2+)] A +7 -0 tests/lowercase-qml-type-name/config.json A +11 -0 tests/lowercase-qml-type-name/main.cpp [License: UNKNOWN] * A +1 -0 tests/lowercase-qml-type-name/main.cpp.expected The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. https://commits.kde.org/clazy/90ef5de73c8cb09eda1480a4930450e243abe6de