mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
[FileItemRolesUpdater] Fix reservation size
The code below always adds the visible range, up to 5 pages before and after the visible range (each capped to ResolveAllItemsLimit/2) and the very first and last page (each up to m_maximumVisibleItems). Use this number to avoid growing the list later.
This commit is contained in:
parent
b4676b71c6
commit
68704c2a28
|
@ -1160,7 +1160,9 @@ QList<int> KFileItemModelRolesUpdater::indexesToResolve() const
|
|||
const int count = m_model->count();
|
||||
|
||||
QList<int> result;
|
||||
result.reserve(ResolveAllItemsLimit);
|
||||
result.reserve(qMin(count, (m_lastVisibleIndex - m_firstVisibleIndex + 1) +
|
||||
ResolveAllItemsLimit +
|
||||
(2 * m_maximumVisibleItems)));
|
||||
|
||||
// Add visible items.
|
||||
for (int i = m_firstVisibleIndex; i <= m_lastVisibleIndex; ++i) {
|
||||
|
|
Loading…
Reference in a new issue