diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-12 18:20:45 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-13 11:40:05 +0100 |
commit | 35f973d2224c514adcd2dfa48fa840d712ed9bf6 (patch) | |
tree | 35ae60cbaccdceac9cfef757b5d03446d27b9976 /src/tools/moc/generator.cpp | |
parent | 67491e2df5357706dbf88ddaf1f030ff095b4528 (diff) |
moc: Record whether a meta object is an object, gadget, or namespace
So far, objects had no identification, and both gadgets and namespaces
were called "gadget". qmltyperegistrar, however, is especially
interested in the distinction between namespaces and anything else.
Task-number: QTBUG-68796
Change-Id: Ic5739727bdef7766de6e535c6568920198fadb2b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r-- | src/tools/moc/generator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 8d4fb2efc6..7264b5bf66 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -381,7 +381,7 @@ void Generator::generateCode() isConstructible ? index : 0); int flags = 0; - if (cdef->hasQGadget) { + if (cdef->hasQGadget || cdef->hasQNamespace) { // Ideally, all the classes could have that flag. But this broke classes generated // by qdbusxml2cpp which generate code that require that we call qt_metacall for properties flags |= PropertyAccessInStaticMetaCall; @@ -541,7 +541,7 @@ void Generator::generateCode() if (isQObject) fprintf(out, " nullptr,\n"); - else if (cdef->superclassList.size() && !cdef->hasQGadget) // for qobject, we know the super class must have a static metaobject + else if (cdef->superclassList.size() && !cdef->hasQGadget && !cdef->hasQNamespace) // for qobject, we know the super class must have a static metaobject fprintf(out, " QMetaObject::SuperData::link<%s::staticMetaObject>(),\n", purestSuperClass.constData()); else if (cdef->superclassList.size()) // for gadgets we need to query at compile time for it fprintf(out, " QtPrivate::MetaObjectForType<%s>::value(),\n", purestSuperClass.constData()); @@ -1179,7 +1179,7 @@ void Generator::generateStaticMetacall() } fprintf(out, ");\n"); fprintf(out, " if (_a[0]) *reinterpret_cast<%s**>(_a[0]) = _r; } break;\n", - cdef->hasQGadget ? "void" : "QObject"); + (cdef->hasQGadget || cdef->hasQNamespace) ? "void" : "QObject"); } fprintf(out, " default: break;\n"); fprintf(out, " }\n"); |