ProjectExplorer: Fix node selection in wizard dialogs

When File>New File or Project is selected, then no node should be selected
on the summary page. If the wizard is triggered via the context menu of the
project tree, then select that node as context instead.

Task-number: QTCREATORBUG-18093
Change-Id: Ic9a14ad72c23c9a40ba2866772e0dcd5b28f9a74
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-05-22 15:21:16 +02:00
parent db84ad5368
commit 013642b0a7

View File

@@ -456,6 +456,11 @@ void ProjectWizardPage::initializeProjectTree(Node *context, const QStringList &
} }
root->prependChild(createNoneNode(&selector)); root->prependChild(createNoneNode(&selector));
// Set combobox to context node:
auto predicate = [context](TreeItem *ti) { return static_cast<AddNewTree*>(ti)->node() == context; };
TreeItem *contextItem = root->findAnyChild(predicate);
m_ui->projectComboBox->setCurrentIndex(m_model.indexForItem(contextItem));
setAdditionalInfo(selector.deployingProjects()); setAdditionalInfo(selector.deployingProjects());
setBestNode(selector.bestChoice()); setBestNode(selector.bestChoice());
setAddingSubProject(action == AddSubProject); setAddingSubProject(action == AddSubProject);