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*/
void RetroshareDirModel::preMods()
{
emit layoutAboutToBeChanged();
mUpdating = true ;
#if QT_VERSION < 0x050000
reset();
#else
beginResetModel();
endResetModel();
#endif
beginResetModel();
#ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::preMods()" << std::endl;
#endif
@ -1120,20 +1114,14 @@ void RetroshareDirModel::preMods()
/* Callback from Core*/
void RetroshareDirModel::postMods()
{
// emit layoutAboutToBeChanged();
mUpdating = false ;
#if QT_VERSION >= 0x040600
beginResetModel();
#endif
#ifdef RDM_DEBUG
std::cerr << "RetroshareDirModel::postMods()" << std::endl;
#endif
#if QT_VERSION >= 0x040600
endResetModel();
#endif
emit layoutChanged();
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(rowCount()-1,COLUMN_COUNT-1,(void*)NULL));
}
void FlatStyle_RDM::postMods()

View File

@ -152,15 +152,13 @@ void RsFriendListModel::setDisplayGroups(bool b)
}
void RsFriendListModel::preMods()
{
emit layoutAboutToBeChanged();
beginResetModel();
}
void RsFriendListModel::postMods()
{
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