Fix soft assert when adding file to subfolder in generic project

We can only select a node directly in the wizard summary page's project
tree, if that is actually listed there.

Task-number: QTCREATORBUG-21342
Change-Id: I52b3db8c38ae2bb59b3f6856e79354ca60a00140
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2018-10-18 11:34:39 +02:00
parent 5bc38589d8
commit 4dbc62a47e

View File

@@ -456,9 +456,10 @@ void ProjectWizardPage::initializeProjectTree(Node *context, const QStringList &
} }
root->prependChild(createNoneNode(&selector)); root->prependChild(createNoneNode(&selector));
// Set combobox to context node: // Set combobox to context node if that appears in the tree:
auto predicate = [context](TreeItem *ti) { return static_cast<AddNewTree*>(ti)->node() == context; }; auto predicate = [context](TreeItem *ti) { return static_cast<AddNewTree*>(ti)->node() == context; };
TreeItem *contextItem = root->findAnyChild(predicate); TreeItem *contextItem = root->findAnyChild(predicate);
if (contextItem)
m_ui->projectComboBox->setCurrentIndex(m_model.indexForItem(contextItem)); m_ui->projectComboBox->setCurrentIndex(m_model.indexForItem(contextItem));
setAdditionalInfo(selector.deployingProjects()); setAdditionalInfo(selector.deployingProjects());