chore(ModelUtils): small optimization for `get`
- do not call `roleByName` twice
This commit is contained in:
parent
efd831eb08
commit
3e051fd79c
|
@ -55,7 +55,7 @@ QVariant ModelUtilsInternal::get(QAbstractItemModel *model,
|
||||||
int row, const QString &roleName) const
|
int row, const QString &roleName) const
|
||||||
{
|
{
|
||||||
if (auto role = roleByName(model, roleName); role != -1)
|
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue