ProjectExplorer: Fix re-detection of mingw toolchains

After restarting Qt Creator, auto-detected mingw toolchains were demoted
to manual toolchains.

Change-Id: Ie30185c0265849c4812dc060f19edea47900a7d1
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2024-09-27 15:34:37 +02:00
parent 37a9afe3f6
commit 1835c9db67

View File

@@ -1668,7 +1668,13 @@ Toolchains GccToolchainFactory::autoDetectToolchains(const FilePaths &compilerPa
}
}
if (existingTcMatches) {
if (existingTc->typeId() == requiredTypeId && !result.contains(existingTc))
// We call this function only once for GCC and MinGW with required type
// GCC_TOOLCHAIN_TYPEID.
const bool typeMatches = existingTc->typeId() == requiredTypeId
|| (existingTc->typeId()
== Constants::MINGW_TOOLCHAIN_TYPEID
&& requiredTypeId == Constants::GCC_TOOLCHAIN_TYPEID);
if (typeMatches && !result.contains(existingTc))
result << existingTc;
alreadyExists = true;
}