summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik@verbruggen.consulting>2021-03-17 11:32:18 +0100
committerErik Verbruggen <erik.verbruggen@me.com>2021-03-18 14:34:04 +0000
commite960062b80e0b37aaf6586d0524f95b4d5fd2d67 (patch)
tree34e390a7797e6637f22cf7a390b9828ea8730a2b /src/libs/qmljs/qmljsmodelmanagerinterface.cpp
parent2361f267322ba30694b4ab6c25f5062a5a3ace03 (diff)
downloadqt-creator-e960062b80e0b37aaf6586d0524f95b4d5fd2d67.tar.gz
QMLJS: Fix usage of default project info
The defaultProjectInfo in the model manager is used as fallback for cases where no applicable ProjectInfo is found. There were a couple of places where this should have been used, but wasn't. This showed when adding a autotest that only used a defaultProjectInfo with no projects defined. Change-Id: If446212dbbdff02fbf1f220d401405d5f99d2de6 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Diffstat (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.cpp')
-rw-r--r--src/libs/qmljs/qmljsmodelmanagerinterface.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
index bb4dde444e..e1189754bd 100644
--- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
+++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp
@@ -641,6 +641,10 @@ QList<ModelManagerInterface::ProjectInfo> ModelManagerInterface::allProjectInfos
if (!info.project.isNull())
infos.append(info);
}
+ if (infos.isEmpty()) {
+ QMutexLocker locker(&m_mutex);
+ return { m_defaultProjectInfo };
+ }
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
return infos;
}
@@ -1200,6 +1204,10 @@ void ModelManagerInterface::updateImportPaths()
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
}
+ for (const auto &importPath : defaultProjectInfo().importPaths) {
+ allImportPaths.maybeInsert(importPath);
+ }
+
for (const QString &path : qAsConst(m_defaultImportPaths))
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), Dialect::Qml);
allImportPaths.compact();
@@ -1432,6 +1440,8 @@ ViewerContext ModelManagerInterface::getVContext(const ViewerContext &vCtx,
info.qtQmlPath = defaultInfo.qtQmlPath;
info.qtVersionString = defaultInfo.qtVersionString;
}
+ if (info.qtQmlPath.isEmpty() && info.importPaths.size() == 0)
+ info.importPaths = defaultInfo.importPaths;
info.applicationDirectories = Utils::filteredUnique(info.applicationDirectories
+ defaultInfo.applicationDirectories);
switch (res.flags) {