From 3633047d812559fc91d6f6324c4677bd886ef7fd Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 6 Oct 2020 12:29:00 +0200 Subject: QmlCompiler: Use the declared typeinfos rather than the default ... and produce a warning when encountering the default. This shows us that the qmake build omits some typeinfo entries from common modules. Add those. Change-Id: I1c7e87e8a54ef24a6076090e6051eb1c03c09b2a Reviewed-by: Fabian Kosmale --- src/qmlcompiler/qqmljsimporter.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/qmlcompiler/qqmljsimporter.cpp') diff --git a/src/qmlcompiler/qqmljsimporter.cpp b/src/qmlcompiler/qqmljsimporter.cpp index 0ea310d64e..a83f344523 100644 --- a/src/qmlcompiler/qqmljsimporter.cpp +++ b/src/qmlcompiler/qqmljsimporter.cpp @@ -105,8 +105,21 @@ QQmlJSImporter::Import QQmlJSImporter::readQmldir(const QString &path) for (auto it = qmlComponents.begin(), end = qmlComponents.end(); it != end; ++it) result.objects.insert(it.key(), it.value()); - if (!reader.plugins().isEmpty() && QFile::exists(path + SlashPluginsDotQmltypes)) - readQmltypes(path + SlashPluginsDotQmltypes, &result.objects); + const auto typeInfos = reader.typeInfos(); + for (const auto &typeInfo : typeInfos) { + const QString typeInfoPath = QFileInfo(typeInfo).isRelative() + ? path + u'/' + typeInfo : typeInfo; + readQmltypes(typeInfoPath, &result.objects); + } + + if (typeInfos.isEmpty() && !reader.plugins().isEmpty()) { + const QString defaultTypeInfoPath = path + SlashPluginsDotQmltypes; + if (QFile::exists(defaultTypeInfoPath)) { + m_warnings.append(QStringLiteral("typeinfo not declared in qmldir file: ") + + defaultTypeInfoPath); + readQmltypes(defaultTypeInfoPath, &result.objects); + } + } const auto scripts = reader.scripts(); for (const auto &script : scripts) { -- cgit v1.2.3