DavidXanatos
5th January 2015, 20:16
Hi
I have a CFilesModel: public QAbstractItemModel that is fed to a QSortFilterProxyModel and this is than fed to a QTreeView
so far so good, the problem arises when I start inserting rows, I get unnecessarily many empty rows and also sometimes crashes when i use beginInsertRows
see void CFilesModel::Fill
EDIT: btw, for the root item beginInsertRows works fine it only messes up when don in a child item :/
my workaround is now not to emit row inserting but instead layoutAboutToBeChanged
see void CFilesModel::Sync(QMap<QString, QList<SFileNode*> >& New, QMap<uint64, SFileNode*>& Old)
I spend a whole day playing around with this damn model and I did not found any way to properly make it working with beginInsertRows
the only workaround I came up with mostly by accident was to use layoutAboutToBeChanged but thats happening on the entire model so it will have a much greater CPU usage :(
can anybody please tell me what I'm doing wrong with this model and the beginInsertRows/endInsertRows emits?
here is my model: http://pastebin.com/NycYhSwM
Cheers
David X.
I have a CFilesModel: public QAbstractItemModel that is fed to a QSortFilterProxyModel and this is than fed to a QTreeView
so far so good, the problem arises when I start inserting rows, I get unnecessarily many empty rows and also sometimes crashes when i use beginInsertRows
see void CFilesModel::Fill
EDIT: btw, for the root item beginInsertRows works fine it only messes up when don in a child item :/
my workaround is now not to emit row inserting but instead layoutAboutToBeChanged
see void CFilesModel::Sync(QMap<QString, QList<SFileNode*> >& New, QMap<uint64, SFileNode*>& Old)
I spend a whole day playing around with this damn model and I did not found any way to properly make it working with beginInsertRows
the only workaround I came up with mostly by accident was to use layoutAboutToBeChanged but thats happening on the entire model so it will have a much greater CPU usage :(
can anybody please tell me what I'm doing wrong with this model and the beginInsertRows/endInsertRows emits?
here is my model: http://pastebin.com/NycYhSwM
Cheers
David X.