qmljs: Fix parsing and and loading of qmldir imports

Add most changes to the qmldir parser of Qt6. This is not a direct
application of the changes because they rely on changes to QtBase that
are Q6 only.
Ignore load errors of optional dependencies.

Fixes: QTCREATORBUG-24772
Change-Id: I0b85818b602c8c7c1712e52318b4ca3f15364cc5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Fawzi Mohamed
2020-11-26 07:32:29 +01:00
parent 23501b4271
commit 5ce8cf70e8
6 changed files with 157 additions and 57 deletions

View File

@@ -554,11 +554,12 @@ static void applyQt515MissingImportWorkaround(const QString &path, LibraryInfo &
return;
if (isQtQuick) {
info.setImports(QStringList(QStringLiteral("QtQml")));
info.setImports(QList<QmlDirParser::Import>(
{QmlDirParser::Import(QLatin1String("QtQml"), ComponentVersion(), 0)}));
} else if (isQtQml) {
info.setImports(QStringList(
{ QStringLiteral("QtQml.Models"),
QStringLiteral("QtQml.WorkerScript") }));
info.setImports(QList<QmlDirParser::Import>(
{ QmlDirParser::Import(QLatin1String("QtQml.Models"), ComponentVersion(), 0),
QmlDirParser::Import(QLatin1String("QtQml.WorkerScript"), ComponentVersion(), 0) }));
}
}