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:
Ali Kianian
2024-10-23 09:27:02 +03:00
parent 53feac4815
commit 68e0b5a3f2

View File

@@ -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;
} }