Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
6.x
Description
QML has multiple declarative macros like QML_ATTACHED, QML_SINGLETON, QML_EXTENDED and so on. These work by adding special member variables and type aliases to the enclosing type where the macro is used.
Later on, we could use these member variables and type aliases to detect whether a specific C++ type has a certain QML attribute (e.g. whether it has an attached type or whether it is a singleton, etc.) at compile time. This is vital information for C++ -> QML type registration.
The problem with the current approach is that member variable and type aliases "leak" into derived C++ type, so that:
class X { QML_ATTACHED(T) // adds "using QmlAttachedType = U;" and other stuff }; class Y : public X {}; // Y::QmlAttachedType exists because X::QmlAttachedType exists
To avoid this, a somewhat generic idea was introduced in [1], however we still lack changes that would correctly handle the information added by [1]. Thus, we have to do it for all the attributes of interest. [2] already does so for extended types and could be used as an example.
[1]: 560a47590fc0c22c18ca91fee56176e2501561f6
[2]: cfbc5ecf2af04e4c0ae6053081b2fa47e8ac5ca8
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-103921 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
415476,1 | Ensure QmlExtended attribute does not leak into derived types in C++ | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
415478,1 | Ensure QmlExtendedNamespace does not leak into derived types in C++ | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
415553,3 | WIP: Ensure QmlInterface attribute does not leak into derived types in C++ | dev | qt/qtdeclarative | Status: ABANDONED | -2 | 0 |