From b913e9d548dfc681172077aa14c1b998488cd2b6 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 25 Apr 2017 15:51:35 +0200 Subject: [PATCH] ProjectExplorer: Make imported buildconfiguration active Make the new buildconfiguration active after it was imported via Project Mode. Before the buildconfiguration was added but the current one was still set, which lead people to believe that the build directory was wrong. Task-number: QTCREATORBUG-18082 Change-Id: I10412d94326d9e21820dfcac89adbe2c5da948ae Reviewed-by: Tim Jenssen --- src/plugins/projectexplorer/projectwindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 88eac526e02..7cbfcef34ba 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -548,6 +548,8 @@ public: dir); FileName path = FileName::fromString(importDir); + Target *lastTarget = nullptr; + BuildConfiguration *lastBc = nullptr; const QList toImport = projectImporter->import(path, false); for (BuildInfo *info : toImport) { Target *target = project->target(info->kitId); @@ -561,8 +563,16 @@ public: BuildConfiguration *bc = info->factory()->create(target, info); QTC_ASSERT(bc, continue); target->addBuildConfiguration(bc); + + lastTarget = target; + lastBc = bc; } } + if (lastTarget && lastBc) { + SessionManager::setActiveBuildConfiguration(lastTarget, lastBc, SetActive::Cascade); + SessionManager::setActiveTarget(project, lastTarget, SetActive::Cascade); + } + qDeleteAll(toImport); }