forked from qt-creator/qt-creator
StudioWelcome: Fix the bug for the index of the ComboBoxHelper
Change-Id: Ic6795ddcc0f25f461bfea212d48ee430d4da672b Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -43,16 +43,14 @@ QString ComboBoxHelper::text(int index) const
|
|||||||
return model->item(index)->text();
|
return model->item(index)->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ComboBoxHelper::indexOf(const QString &) const
|
int ComboBoxHelper::indexOf(const QString &text) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_field, return -1);
|
QTC_ASSERT(m_field, return -1);
|
||||||
|
|
||||||
const QStandardItemModel *model = m_field->model();
|
const QStandardItemModel *model = m_field->model();
|
||||||
for (int i = 0; i < model->rowCount(); ++i) {
|
for (int i = 0; i < model->rowCount(); ++i) {
|
||||||
const QStandardItem *item = model->item(i, 0);
|
const QStandardItem *item = model->item(i, 0);
|
||||||
const QString text = item->text();
|
if (text == item->text())
|
||||||
|
|
||||||
if (text == text)
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user