From b75fe73700bae85af4de3e4159a16276b844557b Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Fri, 15 Jul 2016 11:41:08 +0300 Subject: [PATCH] QStandardItem: enable NRVO for gcc Change-Id: I5a5ad039e1df8f040b77ff783a4f0e1213a0f286 Reviewed-by: Marc Mutz --- src/gui/itemmodels/qstandarditemmodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 7b8d8ae2b7..5c04510af1 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -1805,11 +1805,12 @@ QStandardItem *QStandardItem::takeChild(int row, int column) QList QStandardItem::takeRow(int row) { Q_D(QStandardItem); + QList items; if ((row < 0) || (row >= rowCount())) - return QList(); + return items; if (d->model) d->model->d_func()->rowsAboutToBeRemoved(this, row, row); - QList items; + int index = d->childIndex(row, 0); // Will return -1 if there are no columns if (index != -1) { int col_count = d->columnCount(); @@ -1838,11 +1839,11 @@ QList QStandardItem::takeRow(int row) QList QStandardItem::takeColumn(int column) { Q_D(QStandardItem); + QList items; if ((column < 0) || (column >= columnCount())) - return QList(); + return items; if (d->model) d->model->d_func()->columnsAboutToBeRemoved(this, column, column); - QList items; const int rowCount = d->rowCount(); items.reserve(rowCount);