Unsolved How to mix QSortFilterProxyModel and QAbstractTableModel with fetch more function
-
Hi
I'm usingQTableView
and a model inheritingQAbstractTableModel
with fetch-more function like fetch more example.
Now I want to add a filter. But I dont' know how to get the count of the data after filtering, to be used in fetch-more function. And how to update filtered data used inQAbstractTableModel::data()
Regards
Mihan -
There is nothing special to do.
fetchMore()
notifies the proxy model of the new rows inserted viabeginInsertRows
/endInsertRows
so there is nothing special to do.QSortfilterProxyModel
will work automatically -
@VRonin
But I find that the list will not add new item but will update data if I just update the data vector and do not update the visible count.
e.g.void updateData() { beginResetModel(); GetDataVector(m_Vector); //without reset the visible count //m_VisibleCount = 0; endResetModel(); }
Also I find it will update well if I click the buttom item.
how to improve it? Because I also want to real-time updata it.
-
@Mihan said in How to mix QSortFilterProxyModel and QAbstractTableModel with fetch more function:
But I find that the list will not add new item but will update data if I just update the data vector and do not update the visible count.
I'm sorry but I'm a bit slow. could you explain what you mean here?
it will update well if I click the buttom item.
what button item?