diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/moc/generator.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/moc.cpp | 6 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 1 |
3 files changed, 9 insertions, 4 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"); diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index b562416c31..c175d1d86d 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -923,7 +923,7 @@ void Moc::parse() ClassDef def; static_cast<BaseDef &>(def) = static_cast<BaseDef>(n); def.qualified += def.classname; - def.hasQGadget = true; + def.hasQNamespace = true; auto it = std::find_if(classList.begin(), classList.end(), [&def](const ClassDef &val) { return def.classname == val.classname && def.qualified == val.qualified; }); @@ -1846,8 +1846,12 @@ QJsonObject ClassDef::toJson() const if (!props.isEmpty()) cls[QLatin1String("properties")] = props; + if (hasQObject) + cls[QLatin1String("object")] = true; if (hasQGadget) cls[QLatin1String("gadget")] = true; + if (hasQNamespace) + cls[QLatin1String("namespace")] = true; QJsonArray superClasses; diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 04814b85a1..a3e20a061e 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -192,6 +192,7 @@ struct ClassDef : BaseDef { bool hasQObject = false; bool hasQGadget = false; + bool hasQNamespace = false; QJsonObject toJson() const; }; |