From 45716a4ccccfe3e48dc486c419fefac0be3c3173 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Tue, 29 Sep 2020 09:55:41 +0200 Subject: QmlJS: set and propagate qtVersion in ProjectInfo Change-Id: Icbeb3679c8a76c111a5e3503b2c496c28c830342 Reviewed-by: Ulf Hermann --- src/libs/qmljs/qmljsmodelmanagerinterface.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.cpp') diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index dc4c855c26..b2a6b4f575 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -130,6 +130,7 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent) m_defaultProjectInfo.qtQmlPath = QFileInfo( QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)).canonicalFilePath(); + m_defaultProjectInfo.qtVersionString = QLibraryInfo::version().toString(); updateImportPaths(); @@ -608,8 +609,10 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath( ProjectInfo res; const auto allProjectInfos = allProjectInfosForPath(path); for (const ProjectInfo &pInfo : allProjectInfos) { - if (res.qtQmlPath.isEmpty()) + if (res.qtQmlPath.isEmpty()) { res.qtQmlPath = pInfo.qtQmlPath; + res.qtVersionString = pInfo.qtVersionString; + } res.applicationDirectories.append(pInfo.applicationDirectories); for (const auto &importPath : pInfo.importPaths) res.importPaths.maybeInsert(importPath); @@ -1430,8 +1433,10 @@ ViewerContext ModelManagerInterface::getVContext(const ViewerContext &vCtx, info = projectInfoForPath(doc->fileName()); ViewerContext defaultVCtx = defaultVContext(res.language, Document::Ptr(nullptr), false); ProjectInfo defaultInfo = defaultProjectInfo(); - if (info.qtQmlPath.isEmpty()) + if (info.qtQmlPath.isEmpty()) { info.qtQmlPath = defaultInfo.qtQmlPath; + info.qtVersionString = defaultInfo.qtVersionString; + } info.applicationDirectories = Utils::filteredUnique(info.applicationDirectories + defaultInfo.applicationDirectories); switch (res.flags) { -- cgit v1.2.1