Browse Source

Correctly handle model resetting

adaptive-webui-19844
Vladimir Golovnev (Glassez) 2 years ago
parent
commit
c636618cf3
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 6
      src/gui/torrentcontentmodel.cpp

6
src/gui/torrentcontentmodel.cpp

@ -519,7 +519,8 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage & @@ -519,7 +519,8 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage &
if (filesCount <= 0)
return;
emit layoutAboutToBeChanged();
beginResetModel();
// Initialize files_index array
qDebug("Torrent contains %d files", filesCount);
m_filesIndex.reserve(filesCount);
@ -566,5 +567,6 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage & @@ -566,5 +567,6 @@ void TorrentContentModel::setupModelData(const BitTorrent::AbstractFileStorage &
lastParent->appendChild(fileItem);
m_filesIndex.push_back(fileItem);
}
emit layoutChanged();
endResetModel();
}

Loading…
Cancel
Save