You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Models like ListModel and SortFilterProxyModel have handy count property. However that property is not part of QAbstractItemModel so shouldn't be accessed on models provided from outside in given component. Most proxy models doesn't have count method, in nim code it's present in most models but it's repeating code causing code duplication and risk of bugs.
In our codebase we also use rowCount directly but in most cases it's not reliable because expression won't be re-evaluated on count change.
That problem can be easily solved by generic attached type providing count for every QAbstractItemModel. Than it's enough to use myModel.ModelCount.count to have reliable, bindable count for every QAIM.
The text was updated successfully, but these errors were encountered:
Description
Models like
ListModel
andSortFilterProxyModel
have handycount
property. However that property is not part ofQAbstractItemModel
so shouldn't be accessed on models provided from outside in given component. Most proxy models doesn't havecount
method, innim
code it's present in most models but it's repeating code causing code duplication and risk of bugs.In our codebase we also use
rowCount
directly but in most cases it's not reliable because expression won't be re-evaluated on count change.That problem can be easily solved by generic attached type providing
count
for everyQAbstractItemModel
. Than it's enough to usemyModel.ModelCount.count
to have reliable, bindable count for every QAIM.The text was updated successfully, but these errors were encountered: