diff options
author | Kai Koehne <kai.koehne@qt.io> | 2018-09-18 12:03:09 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2018-10-09 07:50:37 +0000 |
commit | b7f5d34602e72eeda6620ea3e4326c6ff26b52d5 (patch) | |
tree | 5525654e04a9cad638eb925802e9b0f54e8e4bf5 /src/qml/qml/qqmlmetatype.cpp | |
parent | 9aa954e20e9fd02581d7334bda32deeb09752e66 (diff) |
qmlplugindump: Properly handle extension types
Extension classes do augment the primary C++ class with additional
properties that should be part of the QML type. Anyhow, they should
not be visible in the API.
The old logic tried to emulate this by making the extension
class the actual C++ type, and 'inheriting' from the normal
class by setting it in the prototype. Anyhow, this failed for
e.g. Qt3D, where there are numerous types sharing the same
extension class.
Instead, this patch fixes the issue
a) hiding the extension class metainformation itself, and
b) printing properties of the extension class as part of the
main type.
In the QMetaObject collection phase, we now traverse the class
hierarchy using QQmlType::baseMetaObject instead of
QQmlType::metaObject.
In the generation phase, we explicitly resolve the extended type,
and dump additional properties and "DefaultProperty" information
into the main type description.
Note that the ExtendedType sets the DefaultProperty independent
of the version. Changing this would require either revisioning
the defaultProperty, or (again) splitting up the types, which
however brings other problems.
Task-number: QTBUG-70294
Change-Id: I324469152398a605fae9e5a35b619845444ac4e8
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index e34f7a407f..ea4a69f05d 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1080,6 +1080,13 @@ bool QQmlType::isCreatable() const return d && d->regType == CppType && d->extraData.cd->newFunc; } +QQmlType::ExtensionFunc QQmlType::extensionFunction() const +{ + if (!d || d->regType != CppType) + return nullptr; + return d->extraData.cd->extFunc; +} + bool QQmlType::isExtendedType() const { if (!d) |