ProjectExplorer: Prevent target switch on project that's to be removed

Switching targets starts up a lot of machinery that is undesired for a
project that's going away.
The same goes for switching build configurations on a target that is
being removed.

Fixes: QTCREATORBUG-25655
Change-Id: I0cb6e395cca8f89bfeb70fcdf571bbcb64f94247
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Christian Kandeler
2021-05-05 11:18:51 +02:00
parent eafba223a5
commit 201786d3fc
19 changed files with 158 additions and 1 deletions

View File

@@ -39,6 +39,7 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
@@ -647,6 +648,25 @@ ProjectExplorer::DeploymentKnowledge GenericProject::deploymentKnowledge() const
return DeploymentKnowledge::Approximative;
}
void GenericProject::configureAsExampleProject(ProjectExplorer::Kit *kit)
{
QList<BuildInfo> infoList;
const QList<Kit *> kits(kit != nullptr ? QList<Kit *>({kit}) : KitManager::kits());
for (Kit *k : kits) {
if (auto factory = BuildConfigurationFactory::find(k, projectFilePath())) {
for (int i = 0; i < 5; ++i) {
BuildInfo buildInfo;
buildInfo.displayName = tr("Build %1").arg(i + 1);
buildInfo.factory = factory;
buildInfo.kitId = kit->id();
buildInfo.buildDirectory = projectFilePath();
infoList << buildInfo;
}
}
}
setup(infoList);
}
bool GenericProjectFile::reload(QString *errorString, IDocument::ReloadFlag flag, IDocument::ChangeType type)
{
Q_UNUSED(errorString)