From 5e3434396c4c32d6c6e520a72e892f7a1dec9a73 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 11 Mar 2024 13:37:09 +0100 Subject: [PATCH] fixed a few bugs in counting and model parenting --- retroshare-gui/src/gui/common/RsCollectionModel.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/common/RsCollectionModel.cpp b/retroshare-gui/src/gui/common/RsCollectionModel.cpp index d7d352c8a..f05e25231 100644 --- a/retroshare-gui/src/gui/common/RsCollectionModel.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionModel.cpp @@ -22,7 +22,7 @@ static std::ostream& operator<<(std::ostream& o,const RsCollectionModel::EntryIn } static std::ostream& operator<<(std::ostream& o,const QModelIndex& i) { - return o << "QModelIndex (row " << i.row() << ", of ref " << i.internalId() << ")" ; + return o << "QModelIndex (row " << i.row() << ", ref " << i.internalId() << ")" ; } #ifdef DEBUG_COLLECTION_MODEL #endif @@ -200,7 +200,7 @@ QModelIndex RsCollectionModel::parent(const QModelIndex & index) const return QModelIndex(); EntryIndex i; - if(!convertInternalIdToIndex(index.internalId(),i) || i.index==0) + if(index.internalId()==0 || !convertInternalIdToIndex(index.internalId(),i)) return QModelIndex(); EntryIndex p; @@ -276,7 +276,7 @@ bool RsCollectionModel::setData(const QModelIndex& index,const QVariant& value,i { recursSetCheckFlag(dir_data.subdirs[i],s); mDirInfos[index].total_size += mDirInfos[dir_data.subdirs[i]].total_size ; - ++mDirInfos[index].total_count; + mDirInfos[index].total_count+= mDirInfos[dir_data.subdirs[i]].total_count; } for(uint32_t i=0;i