diff options
Diffstat (limited to 'src/qmltyperegistrar')
-rw-r--r-- | src/qmltyperegistrar/qmltypesclassdescription.cpp | 5 | ||||
-rw-r--r-- | src/qmltyperegistrar/qmltypesclassdescription.h | 1 | ||||
-rw-r--r-- | src/qmltyperegistrar/qmltypescreator.cpp | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/qmltyperegistrar/qmltypesclassdescription.cpp b/src/qmltyperegistrar/qmltypesclassdescription.cpp index 94f06a81ee..2214758f38 100644 --- a/src/qmltyperegistrar/qmltypesclassdescription.cpp +++ b/src/qmltyperegistrar/qmltypesclassdescription.cpp @@ -117,6 +117,9 @@ void QmlTypesClassDescription::collect(const QJsonObject *classDef, else if (foreignName == QLatin1String("QML.Attached")) collectAttached(foreignValue, types, foreign, defaultRevision); } + } else { + // The foreign type does not have a meta object: We only override the name. + className = value; } } else if (name == QLatin1String("QML.Root")) { isRootClass = true; @@ -173,6 +176,8 @@ void QmlTypesClassDescription::collect(const QJsonObject *classDef, revisions.erase(end, revisions.end()); resolvedClass = classDef; + if (className.isEmpty() && mode == TopLevel) + className = classDef->value(QLatin1String("qualifiedClassName")).toString(); // If it's not a QObject, it's not creatable isCreatable = isCreatable && classDef->value(QLatin1String("object")).toBool(); diff --git a/src/qmltyperegistrar/qmltypesclassdescription.h b/src/qmltyperegistrar/qmltypesclassdescription.h index abe68d42ed..ed4ba49592 100644 --- a/src/qmltyperegistrar/qmltypesclassdescription.h +++ b/src/qmltyperegistrar/qmltypesclassdescription.h @@ -39,6 +39,7 @@ struct QmlTypesClassDescription { const QJsonObject *resolvedClass = nullptr; QString file; + QString className; QString elementName; QString defaultProp; QString superClass; diff --git a/src/qmltyperegistrar/qmltypescreator.cpp b/src/qmltyperegistrar/qmltypescreator.cpp index 1bccbc36d8..a9885b03fa 100644 --- a/src/qmltyperegistrar/qmltypescreator.cpp +++ b/src/qmltyperegistrar/qmltypescreator.cpp @@ -48,10 +48,7 @@ void QmlTypesCreator::writeClassProperties(const QmlTypesClassDescription &colle { if (!collector.file.isEmpty()) m_qml.writeScriptBinding(QLatin1String("file"), enquote(collector.file)); - m_qml.writeScriptBinding( - QLatin1String("name"), - enquote(collector.resolvedClass->value( - QLatin1String("qualifiedClassName")).toString())); + m_qml.writeScriptBinding(QLatin1String("name"), enquote(collector.className)); if (!collector.defaultProp.isEmpty()) m_qml.writeScriptBinding(QLatin1String("defaultProperty"), enquote(collector.defaultProp)); |