forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Erik Verbruggen
parent
2361f26732
commit
e960062b80
@@ -641,6 +641,10 @@ QList<ModelManagerInterface::ProjectInfo> ModelManagerInterface::allProjectInfos
|
|||||||
if (!info.project.isNull())
|
if (!info.project.isNull())
|
||||||
infos.append(info);
|
infos.append(info);
|
||||||
}
|
}
|
||||||
|
if (infos.isEmpty()) {
|
||||||
|
QMutexLocker locker(&m_mutex);
|
||||||
|
return { m_defaultProjectInfo };
|
||||||
|
}
|
||||||
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
|
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
|
||||||
return infos;
|
return infos;
|
||||||
}
|
}
|
||||||
@@ -1200,6 +1204,10 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const auto &importPath : defaultProjectInfo().importPaths) {
|
||||||
|
allImportPaths.maybeInsert(importPath);
|
||||||
|
}
|
||||||
|
|
||||||
for (const QString &path : qAsConst(m_defaultImportPaths))
|
for (const QString &path : qAsConst(m_defaultImportPaths))
|
||||||
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), Dialect::Qml);
|
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), Dialect::Qml);
|
||||||
allImportPaths.compact();
|
allImportPaths.compact();
|
||||||
@@ -1432,6 +1440,8 @@ ViewerContext ModelManagerInterface::getVContext(const ViewerContext &vCtx,
|
|||||||
info.qtQmlPath = defaultInfo.qtQmlPath;
|
info.qtQmlPath = defaultInfo.qtQmlPath;
|
||||||
info.qtVersionString = defaultInfo.qtVersionString;
|
info.qtVersionString = defaultInfo.qtVersionString;
|
||||||
}
|
}
|
||||||
|
if (info.qtQmlPath.isEmpty() && info.importPaths.size() == 0)
|
||||||
|
info.importPaths = defaultInfo.importPaths;
|
||||||
info.applicationDirectories = Utils::filteredUnique(info.applicationDirectories
|
info.applicationDirectories = Utils::filteredUnique(info.applicationDirectories
|
||||||
+ defaultInfo.applicationDirectories);
|
+ defaultInfo.applicationDirectories);
|
||||||
switch (res.flags) {
|
switch (res.flags) {
|
||||||
|
Reference in New Issue
Block a user