Commit 287f66c4 authored by Tobias Hunger's avatar Tobias Hunger

Kits: Fix corner-case where default kit changed needlessly

Make sure we add Kits (and update the default kit) before removing
existing kits. This prevents us from losing the information on which
kit is the default one for some random kit selected when the previous
default kit gets deleted.

Task-number: QTCREATORBUG-15209
Change-Id: Ieee3b9fdbcbb4eec524103e4b871287c4de02fc7
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 1ffd78bb
......@@ -218,11 +218,7 @@ void KitModel::validateKitNames()
void KitModel::apply()
{
// Remove unused kits:
foreach (KitNode *n, m_toRemoveList)
n->widget->removeKit();
// Update kits:
// Add/update dirty nodes before removing kits. This ensures the right kit ends up as default.
foreach (KitNode *n, itemsAtLevel<KitNode *>(2)) {
if (n->widget->isDirty()) {
n->widget->apply();
......@@ -230,6 +226,10 @@ void KitModel::apply()
}
}
// Remove unused kits:
foreach (KitNode *n, m_toRemoveList)
n->widget->removeKit();
layoutChanged(); // Force update.
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment