Open troyane opened 3 years ago
@oKcerG any input on this?
Hello,
You would need an actual table model (a QAbstractItemModel
with multiple columns) as a source model to be able to use SFPM as the model of a TableView. TableModel instead of ListModel for example.
However SortFilterProxyModel only reads the data from the first column for now for sorting and filtering. One would need to do some modifications to filter and sort on multiple columns.
Hello @oKcerG!
What will be your best bet for usage
SortFilterProxyModel
withTableView
directly (sinceSortFilterProxyModel
is subclass ofQAbstractItemModel
)?Expecting to have something like:
If I override
QQmlSortFilterProxyModel::data
I can see it is executed only for indices:QModelIndex(0,0,...)
QModelIndex(1,0,...)
QModelIndex(2,0,...)
with a different roles numbers (e.g.1
forcost
,0
forname
). But never ask for second column (e.g. indexQModelIndex(0,1,...)
) even if I overridecolumnCount
to return hardcoded value2
.Can you help me to deal with it? Or can you point on the methods that I need to override to make it work properly?
Thanks in advance.