ProjectExplorer: Do not make toolchains sticky in SDK kits

For the case that the installer specified the toolchain
ABI (rather than a concrete toolchain), we now let the user choose.
Note that we do not enforce the original ABI. In practice, this is
anyway redundant with the Qt version, which is still fixed.

Fixes: QTCREATORBUG-25839
Change-Id: Ifd800a736bde59091ce7d07e7a3db1776ad35879
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2021-08-09 14:41:52 +02:00
parent 8139031f2d
commit 04c42db0ad
2 changed files with 9 additions and 4 deletions

View File

@@ -482,14 +482,17 @@ void ToolChainKitAspect::setup(Kit *k)
QTC_ASSERT(k, return);
QVariantMap value = k->value(id()).toMap();
bool lockToolchains = k->isSdkProvided() && !value.isEmpty();
if (value.empty())
value = defaultToolChainValue().toMap();
for (auto i = value.constBegin(); i != value.constEnd(); ++i) {
Utils::Id l = findLanguage(i.key());
if (!l.isValid())
if (!l.isValid()) {
lockToolchains = false;
continue;
}
const QByteArray id = i.value().toByteArray();
ToolChain *tc = ToolChainManager::findToolChain(id);
@@ -497,6 +500,7 @@ void ToolChainKitAspect::setup(Kit *k)
continue;
// ID is not found: Might be an ABI string...
lockToolchains = false;
const QString abi = QString::fromUtf8(id);
tc = ToolChainManager::toolChain([abi, l](const ToolChain *t) {
return t->targetAbi().toString() == abi && t->language() == l;
@@ -506,6 +510,8 @@ void ToolChainKitAspect::setup(Kit *k)
else
clearToolChain(k, l);
}
k->setSticky(id(), lockToolchains);
}
KitAspectWidget *ToolChainKitAspect::createConfigWidget(Kit *k) const

View File

@@ -222,10 +222,9 @@ void KitManager::restoreKits()
// Overwrite settings that the SDK sets to those values:
for (const KitAspect *aspect : KitManager::kitAspects()) {
// Copy sticky settings over:
if (ptr->isSticky(aspect->id())) {
ptr->setSticky(aspect->id(), toStore->isSticky(aspect->id()));
if (ptr->isSticky(aspect->id()))
ptr->setValue(aspect->id(), toStore->value(aspect->id()));
ptr->setSticky(aspect->id(), true);
}
}
toStore = std::move(*i);
kitsToCheck.erase(i);