Skip to content

Commit

Permalink
Switch to QModelIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Emdek committed Feb 23, 2018
1 parent 2035118 commit 1119a9f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ui/preferences/AcceptLanguageDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,17 @@ QString AcceptLanguageDialog::getLanguages()

for (int i = 0; i < m_model->rowCount(); ++i)
{
if (m_model->item(i))
const QModelIndex index(m_model->index(i, 0));

if (index.isValid())
{
if (result.isEmpty())
{
result += m_model->item(i)->data(Qt::UserRole).toString();
result.append(index.data(Qt::UserRole).toString());
}
else
{
result += QStringLiteral(",%1;q=%2").arg(m_model->item(i)->data(Qt::UserRole).toString()).arg(qMax(1 - (i * step), 0.001));
result.append(QStringLiteral(",%1;q=%2").arg(index.data(Qt::UserRole).toString()).arg(qMax(1 - (i * step), 0.001)));
}
}
}
Expand Down

0 comments on commit 1119a9f

Please sign in to comment.