Removing Rows from the QAbstractListModel , which is populated to QML.
I am able to populated items to QML from Qt using QAbstractListModel.
When i am trying to clear items from the QHash<QString, QString> Results;
using following function it is not getting reflected on the QML.
beginRemoveRows(QModelIndex(), 0, Results.size());
I am calling above function before inserting items in to the model in C++.
This function is called when i navigate from one page to another.
Where am i doing wrong ?
AFAIK, if you are using beginRemoveRows then you need to do it in removeRows(). Something like this
bool ListModel::removeRows(int row, int count, const QModelIndex &index)
beginRemoveRows(index, row, row + count - 1);
Another way would be to use beginResetModel()
The issue was ,i am clearing the QHash before processing for Data which will hit the data base.
Thanks for swift reply.