ProjectExplorer: Start with selected kit

If there's one; when clicking "Manage Kits..." in project mode.

Change-Id: I06a92d8e286f7b2b54844b7f41029d7c64684398
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-08-18 17:02:13 +02:00
parent 70aad61e97
commit c18de1ecb6
7 changed files with 68 additions and 55 deletions

View File

@@ -741,8 +741,17 @@ public:
void handleManageKits()
{
if (ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0)) {
KitOptionsPage::showKit(KitManager::kit(Id::fromSetting(projectItem->data(0, KitIdRole))));
const QModelIndexList selected = m_selectorTree->selectionModel()->selectedIndexes();
if (!selected.isEmpty()) {
TreeItem *treeItem = m_projectsModel.itemForIndex(selected.front());
while (treeItem) {
const Id kitId = Id::fromSetting(treeItem->data(0, KitIdRole));
if (kitId.isValid()) {
setSelectectKitId(kitId);
break;
}
treeItem = treeItem->parent();
}
}
ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID);
}