mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Cut down number of signal emits
This commit is contained in:
parent
863c9f9876
commit
72d1d5d2dd
1 changed files with 12 additions and 5 deletions
|
@ -325,13 +325,20 @@ void TransferListModel::handleTorrentStatusUpdated(BitTorrent::TorrentHandle *co
|
|||
void TransferListModel::handleTorrentsUpdated(const QVector<BitTorrent::TorrentHandle *> &torrents)
|
||||
{
|
||||
const int columns = (columnCount() - 1);
|
||||
for (BitTorrent::TorrentHandle *const torrent : torrents) {
|
||||
const int row = m_torrentMap.value(torrent, -1);
|
||||
|
||||
if (row < 0)
|
||||
continue;
|
||||
if (torrents.size() <= (m_torrentList.size() * 0.5)) {
|
||||
for (BitTorrent::TorrentHandle *const torrent : torrents) {
|
||||
const int row = m_torrentMap.value(torrent, -1);
|
||||
|
||||
emit dataChanged(index(row, 0), index(row, columns));
|
||||
if (row < 0)
|
||||
continue;
|
||||
|
||||
emit dataChanged(index(row, 0), index(row, columns));
|
||||
}
|
||||
}
|
||||
else {
|
||||
// save the overhead when more than half of the torrent list needs update
|
||||
emit dataChanged(index(0, 0), index((rowCount() - 1), columns));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue