Commit 6ba90cd0 authored by Nikolai Kosjar's avatar Nikolai Kosjar

QbsProjectManager: Set proper Qt version for C++ Code Model

Change-Id: I04b5524e971e5617a9bae88c1fcab087d62d7a73
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 00b22e40
...@@ -916,12 +916,12 @@ void QbsProject::updateCppCodeModel() ...@@ -916,12 +916,12 @@ void QbsProject::updateCppCodeModel()
QtSupport::BaseQtVersion *qtVersion = QtSupport::BaseQtVersion *qtVersion =
QtSupport::QtKitInformation::qtVersion(activeTarget()->kit()); QtSupport::QtKitInformation::qtVersion(activeTarget()->kit());
CppTools::ProjectPart::QtVersion qtVersionForPart = CppTools::ProjectPart::NoQt; CppTools::ProjectPart::QtVersion qtVersionFromKit = CppTools::ProjectPart::NoQt;
if (qtVersion) { if (qtVersion) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0)) if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
qtVersionForPart = CppTools::ProjectPart::Qt4; qtVersionFromKit = CppTools::ProjectPart::Qt4;
else else
qtVersionForPart = CppTools::ProjectPart::Qt5; qtVersionFromKit = CppTools::ProjectPart::Qt5;
} }
QList<ProjectExplorer::ExtraCompilerFactory *> factories = QList<ProjectExplorer::ExtraCompilerFactory *> factories =
...@@ -955,9 +955,13 @@ void QbsProject::updateCppCodeModel() ...@@ -955,9 +955,13 @@ void QbsProject::updateCppCodeModel()
std::for_each(sourceArtifacts.cbegin(), sourceArtifacts.cend(), pchFinder); std::for_each(sourceArtifacts.cbegin(), sourceArtifacts.cend(), pchFinder);
} }
const CppTools::ProjectPart::QtVersion qtVersionForPart =
prd.moduleProperties().getModuleProperty("Qt.core", "version").isValid()
? qtVersionFromKit
: CppTools::ProjectPart::NoQt;
foreach (const qbs::GroupData &grp, prd.groups()) { foreach (const qbs::GroupData &grp, prd.groups()) {
CppTools::RawProjectPart rpp; CppTools::RawProjectPart rpp;
// TODO: Set the Qt version only if this particular product depends on Qt.
rpp.setQtVersion(qtVersionForPart); rpp.setQtVersion(qtVersionForPart);
const qbs::PropertyMap &props = grp.properties(); const qbs::PropertyMap &props = grp.properties();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment