From a1b378e6f47868af5b94ab2890ee0cf40766a7cf Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 20 Feb 2018 21:07:02 +0100 Subject: [PATCH] fixed ghost rows in TransfersDialog --- .../src/gui/FileTransfer/TransfersDialog.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index fad3b382c..384d5cf5c 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -139,7 +139,7 @@ public: if(!convertRefPointerToTabEntry(ref,entry,source_id) || entry >= mDownloads.size() || source_id > -1) return false ; - return !mDownloads[entry].peers.empty(); // costly + return !mDownloads[entry].peers.empty(); } QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const @@ -242,12 +242,12 @@ public: int source_id=0 ; if(!ref) - return false ; + return QVariant() ; if(!convertRefPointerToTabEntry(ref,entry,source_id) || entry >= mDownloads.size()) { std::cerr << "Bad pointer: " << (void*)ref << std::endl; - return false ; + return QVariant() ; } const FileInfo& finfo(mDownloads[entry]) ; @@ -549,13 +549,13 @@ public: if(old_size < mDownloads.size()) { - beginInsertRows(QModelIndex(), old_size, mDownloads.size()); + beginInsertRows(QModelIndex(), old_size, mDownloads.size()-1); insertRows(old_size, mDownloads.size() - old_size); endInsertRows(); } else if(mDownloads.size() < old_size) { - beginRemoveRows(QModelIndex(), mDownloads.size(), old_size); + beginRemoveRows(QModelIndex(), mDownloads.size(), old_size-1); removeRows(old_size, old_size - mDownloads.size()); endRemoveRows(); } @@ -572,7 +572,7 @@ public: // endResetModel(); - QModelIndex topLeft = createIndex(0,0), bottomRight = createIndex(mDownloads.size(), COLUMN_COUNT-1); + QModelIndex topLeft = createIndex(0,0), bottomRight = createIndex(mDownloads.size()-1, COLUMN_COUNT-1); emit dataChanged(topLeft, bottomRight); //shit code follow (rewrite this please)