QFileSystemModel: reserve() a QList

Change-Id: I136c24382a869ef92446dbe79bfd6a64273e55c6
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
bb10
Marc Mutz 2015-07-16 14:44:23 +02:00 committed by Simon Hausmann
parent 57ae1b15b6
commit 7c8b0c098a
1 changed files with 3 additions and 1 deletions

View File

@ -1197,7 +1197,9 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order)
d->sortOrder = order;
QModelIndexList newList;
for (int i = 0; i < nodeCount; ++i) {
const int numOldNodes = oldNodes.size();
newList.reserve(numOldNodes);
for (int i = 0; i < numOldNodes; ++i) {
const QPair<QFileSystemModelPrivate::QFileSystemNode*, int> &oldNode = oldNodes.at(i);
newList.append(d->index(oldNode.first, oldNode.second));
}