-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Qml: Implement More QML_ELEMENT #13195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7e0db60
to
4e76cdb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the QML registration system by replacing manual qmlRegisterType()
calls with the newer QML_ELEMENT
and QML_UNCREATABLE()
macros. The changes improve compile-time type checking and linting for QML objects, providing better development tooling support.
Key changes include:
- Removal of manual QML type registrations from C++ initialization code
- Addition of QML_ELEMENT macros to C++ class headers
- Update of QML import statements to use consolidated imports
- Cleanup of obsolete registration functions and their calls
Reviewed Changes
Copilot reviewed 300 out of 522 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
Multiple .h files | Added QML_ELEMENT/QML_UNCREATABLE macros to class definitions |
Multiple .cc files | Removed manual qmlRegisterType calls and registration functions |
Multiple .qml files | Updated import statements to use QGroundControl instead of specific modules |
src/QGCApplication.cc | Removed bulk of manual QML type registrations from initialization |
Comments suppressed due to low confidence (1)
src/QmlControls/HorizontalFactValueGrid.qml:22
- [nitpick] The template name 'HorizontalFactValueGridTemplate' is inconsistent with the QML_NAMED_ELEMENT declaration which suggests a more descriptive naming pattern. Consider using a more conventional naming approach.
HorizontalFactValueGridTemplate {
|
||
public: | ||
HorizontalFactValueGrid(QQuickItem *parent = nullptr); | ||
explicit HorizontalFactValueGrid(QQuickItem *parent = nullptr); |
Copilot
AI
Jul 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding 'explicit' to the constructor is good practice, but ensure this change is consistent with the base class constructor pattern and doesn't break existing code that relies on implicit conversion.
Copilot uses AI. Check for mistakes.
|
||
public: | ||
QGCPositionManager(QObject *parent = nullptr); | ||
explicit QGCPositionManager(QObject *parent = nullptr); |
Copilot
AI
Jul 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding 'explicit' to single-parameter constructors is good practice for preventing implicit conversions. Ensure this change is consistently applied across similar constructors in the codebase.
Copilot uses AI. Check for mistakes.
65c1401
to
906daee
Compare
Great stuff, thanks |
Removes most of the manual qml registrations in favor of QML_ELEMENT.
This greatly improves linting and compiling cpp objects to qml.