summary refs log tree commit diff
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-07-28 18:20:23 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2021-07-29 21:07:52 -0400
commit1777a1b52ffcb4e2d3fa0c394b14b3282ef6f3d5 (patch)
treebba2b40e2a430c1a2a84415dd5400cd95a66ef81
parentUse Dialog flag to make tiling WMs happy (diff)
downloadnheko-1777a1b52ffcb4e2d3fa0c394b14b3282ef6f3d5.tar.xz
Reset model instead of doing weird convoluted updates
-rw-r--r--src/ReadReceiptsModel.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/ReadReceiptsModel.cpp b/src/ReadReceiptsModel.cpp
index 8a371922..936c6d61 100644
--- a/src/ReadReceiptsModel.cpp
+++ b/src/ReadReceiptsModel.cpp
@@ -76,9 +76,7 @@ void
 ReadReceiptsModel::addUsers(
   const std::multimap<uint64_t, std::string, std::greater<uint64_t>> &users)
 {
-        auto oldLen = readReceipts_.length();
-
-        beginInsertRows(QModelIndex{}, oldLen, users.size() - 1);
+        beginResetModel();
 
         readReceipts_.clear();
         for (const auto &user : users) {
@@ -92,9 +90,7 @@ ReadReceiptsModel::addUsers(
                           return a.second > b.second;
                   });
 
-        endInsertRows();
-
-        emit dataChanged(index(0), index(oldLen - 1));
+        endResetModel();
 }
 
 QString