mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-30 11:38:50 -07:00
Reserve space before appending elements
This commit is contained in:
parent
93429840c8
commit
529c1ec9f4
1 changed files with 5 additions and 2 deletions
|
@ -632,9 +632,12 @@ bool TransferListModel::setData(const QModelIndex &index, const QVariant &value,
|
||||||
|
|
||||||
void TransferListModel::addTorrents(const QVector<BitTorrent::Torrent *> &torrents)
|
void TransferListModel::addTorrents(const QVector<BitTorrent::Torrent *> &torrents)
|
||||||
{
|
{
|
||||||
int row = m_torrentList.size();
|
qsizetype row = m_torrentList.size();
|
||||||
beginInsertRows({}, row, (row + torrents.size()));
|
const qsizetype total = row + torrents.size();
|
||||||
|
|
||||||
|
beginInsertRows({}, row, total);
|
||||||
|
|
||||||
|
m_torrentList.reserve(total);
|
||||||
for (BitTorrent::Torrent *torrent : torrents)
|
for (BitTorrent::Torrent *torrent : torrents)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!m_torrentMap.contains(torrent));
|
Q_ASSERT(!m_torrentMap.contains(torrent));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue