diff options
Diffstat (limited to 'src/corelib/kernel/qmetaobjectbuilder.cpp')
| -rw-r--r-- | src/corelib/kernel/qmetaobjectbuilder.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 9d3d3266b2a..96b25bd3722 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -1253,8 +1253,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, // Output the methods in the class. Q_ASSERT(!buf || dataIndex == pmeta->methodData); - // + 1 for metatype of this metaobject - int parameterMetaTypesIndex = int(d->properties.size()) + 1; + // property count + enum count + 1 for metatype of this metaobject + int parameterMetaTypesIndex = int(d->properties.size()) + int(d->enumerators.size()) + 1; for (const auto &method : d->methods) { [[maybe_unused]] int name = strings.enter(method.name()); int argc = method.parameterCount(); @@ -1418,12 +1418,19 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, } ALIGN(size, QtPrivate::QMetaTypeInterface *); - auto types = reinterpret_cast<QtPrivate::QMetaTypeInterface **>(buf + size); + auto types = reinterpret_cast<const QtPrivate::QMetaTypeInterface **>(buf + size); if constexpr (mode == Construct) { meta->d.metaTypes = types; for (const auto &prop : d->properties) { QMetaType mt = prop.metaType; - *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt); + *types = mt.iface(); + types++; + } + // add metatypes for enumerators + for (const auto &enumerator: d->enumerators) { + QMetaType mt = enumerator.metaType; + mt.registerType(); + *types = mt.iface(); types++; } // add metatype interface for this metaobject - must be null @@ -1436,14 +1443,14 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, types++; for (const auto ¶meterType: method.parameterTypes()) { QMetaType mt = QMetaType::fromName(parameterType); - *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt); + *types = mt.iface(); types++; } } for (const auto &constructor : d->constructors) { for (const auto ¶meterType : constructor.parameterTypes()) { QMetaType mt = QMetaType::fromName(parameterType); - *types = reinterpret_cast<QtPrivate::QMetaTypeInterface *&>(mt); + *types = mt.iface(); types++; } } |
