uniformise calls to [begin/end]ResetModel() and removed calls to layoutAboutToBeChanged() as it may cause some SIGSEGV

This commit is contained in:
csoler 2020-08-16 22:17:54 +02:00
parent 82ba488574
commit 3b7734c934
2 changed files with 5 additions and 19 deletions

View file

@ -1103,15 +1103,9 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
/* Callback from Core*/ /* Callback from Core*/
void RetroshareDirModel::preMods() void RetroshareDirModel::preMods()
{ {
emit layoutAboutToBeChanged();
mUpdating = true ; mUpdating = true ;
#if QT_VERSION < 0x050000
reset();
#else
beginResetModel();
endResetModel();
#endif
beginResetModel();
#ifdef RDM_DEBUG #ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::preMods()" << std::endl; std::cerr << "RetroshareDirModel::preMods()" << std::endl;
#endif #endif
@ -1120,20 +1114,14 @@ void RetroshareDirModel::preMods()
/* Callback from Core*/ /* Callback from Core*/
void RetroshareDirModel::postMods() void RetroshareDirModel::postMods()
{ {
// emit layoutAboutToBeChanged();
mUpdating = false ; mUpdating = false ;
#if QT_VERSION >= 0x040600
beginResetModel();
#endif
#ifdef RDM_DEBUG #ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::postMods()" << std::endl; std::cerr << "RetroshareDirModel::postMods()" << std::endl;
#endif #endif
#if QT_VERSION >= 0x040600
endResetModel(); endResetModel();
#endif
emit layoutChanged(); emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,COLUMN_COUNT-1,(void*)NULL));
} }
void FlatStyle_RDM::postMods() void FlatStyle_RDM::postMods()

View file

@ -152,15 +152,13 @@ void RsFriendListModel::setDisplayGroups(bool b)
} }
void RsFriendListModel::preMods() void RsFriendListModel::preMods()
{ {
emit layoutAboutToBeChanged();
beginResetModel(); beginResetModel();
} }
void RsFriendListModel::postMods() void RsFriendListModel::postMods()
{ {
endResetModel(); endResetModel();
emit layoutChanged();
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mTopLevel.size()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL)); emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL));
} }
int RsFriendListModel::rowCount(const QModelIndex& parent) const int RsFriendListModel::rowCount(const QModelIndex& parent) const