From 6c143049c57d6a0fbd2c23357a0fd4b0ae25cac1 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Thu, 28 Jan 2016 20:56:26 -0500 Subject: [PATCH] Attempts to debug an issue that causes files to load up with twice the number of actual frames. --- canframemodel.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/canframemodel.cpp b/canframemodel.cpp index ed8f17a..98385cf 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -362,19 +362,27 @@ void CANFrameModel::sendBulkRefresh(int num) //of how many by tracking the number we last knew about as opposed to how many rows there //are now. num = filteredFrames.count() - lastUpdateNumFrames; - lastUpdateNumFrames += num; //done this way to avoid asking for filteredFrames.count() again + + if (num < 0) return; + + //qDebug() << "Num: " << num; if (num == 0 && !overwriteDups) return; if (filteredFrames.count() == 0) return; + lastUpdateNumFrames += num; //done this way to avoid asking for filteredFrames.count() again + qDebug() << "Bulk refresh of " << num; if (!overwriteDups) { mutex.lock(); if (num > filteredFrames.count()) num = filteredFrames.count(); - beginInsertRows(QModelIndex(), filteredFrames.count() - num, filteredFrames.count() - 1); - endInsertRows(); + //qDebug() << "From " << (filteredFrames.count() - num) << " to " << (filteredFrames.count() - 1); + //beginInsertRows(QModelIndex(), filteredFrames.count() - num, filteredFrames.count() - 1); + //endInsertRows(); + beginResetModel(); + endResetModel(); mutex.unlock(); } else