SummaryPage: Be more robust wrt. selecting from the combobox

QComboBox::view() is the popup only, so do not use that to query for
the selected value of the combobox.

Task-number: QTCREATORBUG-15454
Change-Id: I1279a1c35e7e6f092d623199203ea50620690304
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-12-10 16:17:00 +01:00
parent 4b93663acd
commit 48270d58a6

View File

@@ -128,6 +128,8 @@ QVariant AddNewTree::data(int, int role) const
return m_displayName; return m_displayName;
if (role == Qt::ToolTipRole) if (role == Qt::ToolTipRole)
return m_toolTip; return m_toolTip;
if (role == Qt::UserRole)
return QVariant::fromValue(static_cast<void*>(node()));
return QVariant(); return QVariant();
} }
@@ -403,9 +405,8 @@ void ProjectWizardPage::setBestNode(AddNewTree *tree)
FolderNode *ProjectWizardPage::currentNode() const FolderNode *ProjectWizardPage::currentNode() const
{ {
QModelIndex index = m_ui->projectComboBox->view()->currentIndex(); QVariant v = m_ui->projectComboBox->currentData(Qt::UserRole);
TreeItem *item = m_model->itemForIndex(index); return v.isNull() ? 0 : static_cast<FolderNode *>(v.value<void *>());
return item ? static_cast<AddNewTree *>(item)->node() : 0;
} }
void ProjectWizardPage::setAddingSubProject(bool addingSubProject) void ProjectWizardPage::setAddingSubProject(bool addingSubProject)