diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 37d2e595c10..1d84dfe0155 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -603,7 +603,31 @@ void ModelManagerInterface::removeProjectInfo(ProjectExplorer::Project *project) } } -ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QString path) const +/*! + Returns project info with summarized info for \a path + + \note Project pointer will be empty + */ +ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(const QString &path) const +{ + QList infos = allProjectInfosForPath(path); + + ProjectInfo res; + foreach (const ProjectInfo &pInfo, infos) { + if (res.qtImportsPath.isEmpty()) + res.qtImportsPath = pInfo.qtImportsPath; + if (res.qtQmlPath.isEmpty()) + res.qtQmlPath = pInfo.qtQmlPath; + for (int i = 0; i < pInfo.importPaths.size(); ++i) + res.importPaths.maybeInsert(pInfo.importPaths.at(i)); + } + return res; +} + +/*! + Returns list of project infos for \a path + */ +QList ModelManagerInterface::allProjectInfosForPath(const QString &path) const { QList projects; { @@ -622,17 +646,7 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QSt } std::sort(infos.begin(), infos.end(), &pInfoLessThanImports); infos.append(m_defaultProjectInfo); - - ProjectInfo res; - foreach (const ProjectInfo &pInfo, infos) { - if (res.qtImportsPath.isEmpty()) - res.qtImportsPath = pInfo.qtImportsPath; - if (res.qtQmlPath.isEmpty()) - res.qtQmlPath = pInfo.qtQmlPath; - for (int i = 0; i < pInfo.importPaths.size(); ++i) - res.importPaths.maybeInsert(pInfo.importPaths.at(i)); - } - return res; + return infos; } bool ModelManagerInterface::isIdle() const diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h index df232598811..18ed602fc40 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -177,7 +177,8 @@ public: void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info); void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc); void updateQrcFile(const QString &path); - ProjectInfo projectInfoForPath(QString path) const; + ProjectInfo projectInfoForPath(const QString &path) const; + QList allProjectInfosForPath(const QString &path) const; bool isIdle() const ; PathsAndLanguages importPaths() const;