summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/generator.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-27 19:16:17 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-24 00:19:36 +0200
commit0161f00e5043090f22b23de9822c09062b17d675 (patch)
treee2a6d59028ada109a79c60d32186f9661eb5c67f /src/tools/moc/generator.cpp
parent700e6341e51f5e6f45303fab3d0a84a3eb249eba (diff)
Use QMetaType in QMetaCallEvent
And don't use int based type mapping anymore. Change-Id: I456e76d1933ef646a7bd39ce565886b89e938a44 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r--src/tools/moc/generator.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 7754771332..cc43ca4490 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1016,7 +1016,7 @@ void Generator::generateMetacall()
fprintf(out, " if (_id < %d)\n", int(methodList.size()));
if (methodsWithAutomaticTypesHelper(methodList).isEmpty())
- fprintf(out, " *reinterpret_cast<int*>(_a[0]) = -1;\n");
+ fprintf(out, " *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType();\n");
else
fprintf(out, " qt_static_metacall(this, _c, _id, _a);\n");
fprintf(out, " _id -= %d;\n }", int(methodList.size()));
@@ -1177,13 +1177,13 @@ void Generator::generateStaticMetacall()
if (!methodsWithAutomaticTypes.isEmpty()) {
fprintf(out, " else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {\n");
fprintf(out, " switch (_id) {\n");
- fprintf(out, " default: *reinterpret_cast<int*>(_a[0]) = -1; break;\n");
+ fprintf(out, " default: *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); break;\n");
QMap<int, QMultiMap<QByteArray, int> >::const_iterator it = methodsWithAutomaticTypes.constBegin();
const QMap<int, QMultiMap<QByteArray, int> >::const_iterator end = methodsWithAutomaticTypes.constEnd();
for ( ; it != end; ++it) {
fprintf(out, " case %d:\n", it.key());
fprintf(out, " switch (*reinterpret_cast<int*>(_a[1])) {\n");
- fprintf(out, " default: *reinterpret_cast<int*>(_a[0]) = -1; break;\n");
+ fprintf(out, " default: *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType(); break;\n");
auto jt = it->begin();
const auto jend = it->end();
while (jt != jend) {
@@ -1191,7 +1191,7 @@ void Generator::generateStaticMetacall()
const QByteArray &lastKey = jt.key();
++jt;
if (jt == jend || jt.key() != lastKey)
- fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", lastKey.constData());
+ fprintf(out, " *reinterpret_cast<QMetaType *>(_a[0]) = QMetaType::fromType< %s >(); break;\n", lastKey.constData());
}
fprintf(out, " }\n");
fprintf(out, " break;\n");