@FPEY said in QSortFilterProxyModel: Reset model shows ghost items:
EDIT: Nevermind, my issue was also a stupid mistake: I was simply not calling the function to make the whole reset model stuff when I had multiple lines selected ^^
Glad to hear that you managed to resolve your issue :)
I'm not exactly sure where the problem I was facing originated from hence I didn't leave any details as I don't want people to be mislead.
This was my first time working with QStandardItemModel. So far I have always implemented models directly by deriving from QAbstractItemModel.
When using the QStandardItemModel with the proxy model, the proxy's state was not invalidated when rows were inserted or removed (again, I don't know (yet) why).
The quick fix without actually understanding the problem was to invoke the QStandardItemModel::invalidate slot whenever rows were either inserted or removed:
connect(m_model, &model::rowsInserted, m_proxy_model, &QSortFilterProxyModel::invalidate);
connect(m_model, &model::rowsRemoved, m_proxy_model, &QSortFilterProxyModel::invalidate);
Where:
m_model is of type QStandardItemModel*
m_proxy_model is of type QSortFilterProxyModel*