chore(ModelUtils): small optimization for `get`

- do not call `roleByName` twice
This commit is contained in:
Lukáš Tinkl 2024-04-09 15:00:20 +02:00 committed by Lukáš Tinkl
parent efd831eb08
commit 3e051fd79c
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ QVariant ModelUtilsInternal::get(QAbstractItemModel *model,
int row, const QString &roleName) const
{
if (auto role = roleByName(model, roleName); role != -1)
return model->data(model->index(row, 0), roleByName(model, roleName));
return model->data(model->index(row, 0), role);
return {};
}