diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-10 12:49:33 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-10 19:48:42 +0000 |
commit | 79c170d8bdafb91da30d17a24d00457f2be478b3 (patch) | |
tree | 74ef24f46510e4b26339fa8d21ff1d3fce6f38c2 /sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | |
parent | 723ed2053aed8b72ae534fcbaea5aaee7f5ea9ba (diff) |
shiboken: Remove some special handling for QObject's
For types, QObjects are equivalent to objects, there is no need to
differentiate. Remove the code trying to find whether a type is a
QObject.
Only AbstractMetaClass needs to know whether it inherits QObject. Add
a simple check recursing down the base classes.
Change-Id: I2365b451c8873f044b06c09b58aff29e2db3c5b7
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index cac96cb43..329e3b079 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -391,27 +391,6 @@ void AbstractMetaBuilderPrivate::traverseStreamOperator(const FunctionModelItem } } -void AbstractMetaBuilderPrivate::fixQObjectForScope(const FileModelItem &dom, - const TypeDatabase *types, - const NamespaceModelItem &scope) -{ - const ClassList &scopeClasses = scope->classes(); - for (const ClassModelItem &item : scopeClasses) { - QString qualifiedName = item->qualifiedName().join(colonColon()); - TypeEntry* entry = types->findType(qualifiedName); - if (entry) { - if (isQObject(dom, qualifiedName) && entry->isComplex()) - static_cast<ComplexTypeEntry *>(entry)->setQObject(true); - } - } - - const NamespaceList &namespaces = scope->namespaces(); - for (const NamespaceModelItem &n : namespaces) { - if (scope != n) - fixQObjectForScope(dom, types, n); - } -} - void AbstractMetaBuilderPrivate::sortLists() { for (AbstractMetaClass *cls : qAsConst(m_metaClasses)) @@ -447,9 +426,6 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom) pushScope(dom); - // fix up QObject's in the type system.. - fixQObjectForScope(dom, types, dom); - // Start the generation... const ClassList &typeValues = dom->classes(); ReportHandler::setProgressReference(typeValues); @@ -1003,9 +979,6 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelIt if (!type) return 0; - if (type->isObject()) - static_cast<ObjectTypeEntry *>(type)->setQObject(isQObject(dom, stripTemplateArgs(typeDef->type().qualifiedName().join(colonColon())))); - AbstractMetaClass *metaClass = new AbstractMetaClass; metaClass->setTypeDef(true); metaClass->setTypeEntry(type); @@ -1069,9 +1042,6 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem return 0; } - if (type->isObject()) - ((ObjectTypeEntry*)type)->setQObject(isQObject(dom, fullClassName)); - AbstractMetaClass *metaClass = new AbstractMetaClass; metaClass->setTypeEntry(type); @@ -1438,12 +1408,6 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem, .arg(metaFunction->name(), metaClass->name()); } - if (metaFunction->isSignal() && !metaClass->isQObject()) { - qCWarning(lcShiboken).noquote().nospace() - << QStringLiteral("signal '%1' in non-QObject class '%2'") - .arg(metaFunction->name(), metaClass->name()); - } - if (metaFunction->isConversionOperator()) fixReturnTypeOfConversionOperator(metaFunction); @@ -2538,38 +2502,6 @@ QString AbstractMetaBuilderPrivate::fixDefaultValue(const ArgumentModelItem &ite return expr; } -bool AbstractMetaBuilderPrivate::isQObject(const FileModelItem &dom, const QString &qualifiedName) -{ - if (qualifiedName == QLatin1String("QObject")) - return true; - - ClassModelItem classItem = dom->findClass(qualifiedName); - - if (!classItem) { - QStringList names = qualifiedName.split(colonColon()); - NamespaceModelItem ns = dom; - for (int i = 0; i < names.size() - 1 && ns; ++i) - ns = ns->findNamespace(names.at(i)); - if (ns && names.size() >= 2) - classItem = ns->findClass(names.at(names.size() - 1)); - } - - if (!classItem) - return false; - - if (classItem->extendsClass(QLatin1String("QObject"))) - return true; - - const QVector<_ClassModelItem::BaseClass> &baseClasses = classItem->baseClasses(); - for (const _ClassModelItem::BaseClass &baseClass : baseClasses) { - if (isQObject(dom, baseClass.name)) - return true; - } - - return false; -} - - bool AbstractMetaBuilderPrivate::isEnum(const FileModelItem &dom, const QStringList& qualified_name) { CodeModelItem item = dom->model()->findItem(qualified_name, dom); |