diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-02-01 15:03:19 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-02-01 16:51:51 +0100 |
commit | f6fc35b45b449fe7aaca3237f29393a12fc3f90c (patch) | |
tree | bd808ac4fd916f49417f08e0e32105e614c7f0fd /src/qml/qml | |
parent | 24ec3b3e7fa09900d791dcaedb0820a0b1890336 (diff) |
QmlCompiler: Allow for multiple extensions per object
Previously, the assumption was that each object could only have a single
extension object. As proven by the new qqmllanguage test this is not the
case. Each registered object in the type hierarchy can have its own
extension. Therefore, adjust the algorithms that generate qmltypes and
iterate the extension objects when analyzing them.
This leads us to the realization that anonymous types can in fact
meaningfully carry extensions and implement interfaces. Adapt
qmltyperegistrar accordingly.
For the test to compile, however, we need to realize that the class
declaring interfaces needs to befriend all potential subclass's
QmlInterface structs. Fix that, too. The rabbit hole went deep.
Change-Id: Ia451897e927e03b95c3062e829edf1dfcd216613
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqml.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index 61eb5e1ffe..078bd93d25 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -153,7 +153,8 @@ #define QML_IMPLEMENTS_INTERFACES(INTERFACES) \ Q_INTERFACES(INTERFACES) \ - enum class QmlIsInterface {yes = false}; + enum class QmlIsInterface {yes = false}; \ + template<typename, typename> friend struct QML_PRIVATE_NAMESPACE::QmlInterface; #define QML_UNAVAILABLE \ QML_FOREIGN(QQmlTypeNotAvailable) |