QStandardItem: use reserve() to optimize memory allocation
Change-Id: I09df41f6beaaeecc818f11a01206e9e4583fd93f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
e46e112eb1
commit
337a7e96b6
@ -1844,7 +1844,9 @@ QList<QStandardItem*> QStandardItem::takeColumn(int column)
|
|||||||
d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
|
d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
|
||||||
QList<QStandardItem*> items;
|
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);
|
int index = d->childIndex(row, column);
|
||||||
QStandardItem *ch = d->children.at(index);
|
QStandardItem *ch = d->children.at(index);
|
||||||
if (ch)
|
if (ch)
|
||||||
|
Loading…
Reference in New Issue
Block a user