mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
trying new notification system using begin/end remove/insert rows to avoid crash
This commit is contained in:
parent
b63544e856
commit
6fae40d417
@ -53,13 +53,12 @@ RsGxsForumModel::RsGxsForumModel(QObject *parent)
|
|||||||
void RsGxsForumModel::preMods()
|
void RsGxsForumModel::preMods()
|
||||||
{
|
{
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
beginResetModel();
|
|
||||||
}
|
}
|
||||||
void RsGxsForumModel::postMods()
|
void RsGxsForumModel::postMods()
|
||||||
{
|
{
|
||||||
endResetModel();
|
//emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount(QModelIndex())-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
||||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(0,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(0,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
|
||||||
emit layoutChanged();
|
//emit layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsForumModel::setTreeMode(TreeMode mode)
|
void RsGxsForumModel::setTreeMode(TreeMode mode)
|
||||||
@ -695,6 +694,9 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
|
|||||||
{
|
{
|
||||||
preMods();
|
preMods();
|
||||||
|
|
||||||
|
beginRemoveRows(QModelIndex(),0,mPosts[0].mChildren.size()-1);
|
||||||
|
endRemoveRows();
|
||||||
|
|
||||||
mForumGroup = group;
|
mForumGroup = group;
|
||||||
mPosts = posts;
|
mPosts = posts;
|
||||||
mPostVersions = post_versions;
|
mPostVersions = post_versions;
|
||||||
@ -716,6 +718,8 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
|
|||||||
debug_dump();
|
debug_dump();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
beginInsertRows(QModelIndex(),0,mPosts[0].mChildren.size()-1);
|
||||||
|
endInsertRows();
|
||||||
postMods();
|
postMods();
|
||||||
emit forumLoaded();
|
emit forumLoaded();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user