Reset model instead of doing weird convoluted updates

This commit is contained in:
Loren Burkholder 2021-07-28 18:20:23 -04:00
parent 5d38b96bbb
commit 1777a1b52f
1 changed files with 2 additions and 6 deletions

View File

@ -76,9 +76,7 @@ void
ReadReceiptsModel::addUsers( ReadReceiptsModel::addUsers(
const std::multimap<uint64_t, std::string, std::greater<uint64_t>> &users) const std::multimap<uint64_t, std::string, std::greater<uint64_t>> &users)
{ {
auto oldLen = readReceipts_.length(); beginResetModel();
beginInsertRows(QModelIndex{}, oldLen, users.size() - 1);
readReceipts_.clear(); readReceipts_.clear();
for (const auto &user : users) { for (const auto &user : users) {
@ -92,9 +90,7 @@ ReadReceiptsModel::addUsers(
return a.second > b.second; return a.second > b.second;
}); });
endInsertRows(); endResetModel();
emit dataChanged(index(0), index(oldLen - 1));
} }
QString QString