partially revert 2fa4e0cdc5

prefixing the list with extra is really missleading, the reverted hunk is
for the related metaobjects

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-26 23:59:13 +03:00
parent 65d8629a0c
commit dbed1f76ed

View file

@ -256,6 +256,37 @@ void Generator::generateCode()
if (cdef->hasQObject && !isQt) if (cdef->hasQObject && !isQt)
generateStaticMetacall(); generateStaticMetacall();
//
// Build extra array
//
QList<QByteArray> extraList;
for (int i = 0; i < cdef->propertyList.count(); ++i) {
const PropertyDef &p = cdef->propertyList.at(i);
if (!isVariantType(p.type.constData()) && !metaTypes.contains(p.type) && !p.type.contains('*') &&
!p.type.contains('<') && !p.type.contains('>')) {
int s = p.type.lastIndexOf("::");
if (s > 0) {
QByteArray scope = p.type.left(s);
if (scope != "Qt" && scope != cdef->classname && !extraList.contains(scope))
extraList += scope;
}
}
}
if (!extraList.isEmpty()) {
fprintf(out, "#ifdef Q_NO_DATA_RELOCATION\n");
fprintf(out, "static const QMetaObjectAccessor qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData());
for (int i = 0; i < extraList.count(); ++i) {
fprintf(out, " %s::getStaticMetaObject,\n", extraList.at(i).constData());
}
fprintf(out, "#else\n");
fprintf(out, "static const QMetaObject *qt_meta_extradata_%s[] = {\n ", qualifiedClassNameIdentifier.constData());
for (int i = 0; i < extraList.count(); ++i) {
fprintf(out, " &%s::staticMetaObject,\n", extraList.at(i).constData());
}
fprintf(out, "#endif //Q_NO_DATA_RELOCATION\n");
fprintf(out, "\n};\n\n");
}
// //
// Finally create and initialize the static meta object // Finally create and initialize the static meta object
// //
@ -277,7 +308,11 @@ void Generator::generateCode()
else else
fprintf(out, " nullptr, "); fprintf(out, " nullptr, ");
fprintf(out, "nullptr}\n};\n\n"); if (extraList.isEmpty())
fprintf(out, "nullptr");
else
fprintf(out, "qt_meta_extradata_%s ", qualifiedClassNameIdentifier.constData());
fprintf(out, "}\n};\n\n");
if(isQt) if(isQt)
return; return;