QStandardItem: use reserve() to optimize memory allocation

Change-Id: I09df41f6beaaeecc818f11a01206e9e4583fd93f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
Anton Kudryavtsev 2016-07-08 13:21:20 +03:00
parent e46e112eb1
commit 337a7e96b6
1 changed files with 3 additions and 1 deletions

View File

@ -1844,7 +1844,9 @@ QList<QStandardItem*> QStandardItem::takeColumn(int column)
d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
QList<QStandardItem*> items;
for (int row = d->rowCount() - 1; row >= 0; --row) {
const int rowCount = d->rowCount();
items.reserve(rowCount);
for (int row = rowCount - 1; row >= 0; --row) {
int index = d->childIndex(row, column);
QStandardItem *ch = d->children.at(index);
if (ch)