aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-06 12:29:00 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-07 11:25:40 +0000
commit3633047d812559fc91d6f6324c4677bd886ef7fd (patch)
treef39250b047dda6a53ffd3c01c24daa80355b0b03 /src/qmlcompiler
parent26fa3d2cef8ec55dfb276e999d41e01e9a846093 (diff)
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler')
-rw-r--r--src/qmlcompiler/qqmljsimporter.cpp17
1 files changed, 15 insertions, 2 deletions
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) {