Fix Qt version for auto-detected kits

Fixes a regression in d4565be655 that
leads to all desktop Kits being assigned a default desktop Qt version,
even though the installer registered these kits with a specific Qt.

Implementations of KitAspect::setup may not unconditionally override an
existing value, since it is called on the kits restored from the install
settings. This is needed because the installer registers toolchains and
debuggers by referring to them via an ABI ("this kit has a debugger that
can handle this specific ABI"), since the installer doesn't know e.g.
about installed MSVC toolchains itself.
That's why ToolChainKitAspect and DebuggerKitAspect may modify an
existing value in their "setup" method. If this should be moved
somewhere else, e.g. "fix", should be investigated, but in a separate
refactoring.

Change-Id: Ibd99e4da03cd7130c49294f4ac79cd8e346fb1b7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2019-05-06 14:55:34 +02:00
parent da472ced46
commit 534fcfcd45
4 changed files with 7 additions and 2 deletions

View File

@@ -82,6 +82,7 @@ AndroidGdbServerKitAspect::AndroidGdbServerKitAspect()
void AndroidGdbServerKitAspect::setup(Kit *kit)
{
if (kit && !kit->hasValue(id()))
kit->setValue(id(), autoDetect(kit).toString());
}

View File

@@ -692,6 +692,8 @@ QList<Task> CMakeGeneratorKitAspect::validate(const Kit *k) const
void CMakeGeneratorKitAspect::setup(Kit *k)
{
if (!k || k->hasValue(id()))
return;
GeneratorInfo info;
info.fromVariant(defaultValue(k));
setGeneratorInfo(k, info);

View File

@@ -805,7 +805,7 @@ DeviceTypeKitAspect::DeviceTypeKitAspect()
void DeviceTypeKitAspect::setup(Kit *k)
{
if (k)
if (k && !k->hasValue(id()))
k->setValue(id(), QByteArray(Constants::DESKTOP_DEVICE_TYPE));
}

View File

@@ -163,6 +163,8 @@ QtKitAspect::QtKitAspect()
void QtKitAspect::setup(ProjectExplorer::Kit *k)
{
if (!k || k->hasValue(id()))
return;
const Abi tcAbi = ToolChainKitAspect::targetAbi(k);
const Core::Id deviceType = DeviceTypeKitAspect::deviceTypeId(k);