Reset model instead of doing weird convoluted updates
This commit is contained in:
parent
5d38b96bbb
commit
1777a1b52f
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user