summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-03-02 01:12:44 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-06-20 11:39:48 +0000
commite173403971565d142dc638e4d543e1d37fd9a537 (patch)
treeb1f5c3cde6cb4d2bfa223fc405e536529fc3766e /src/widgets/itemviews
parent0e39aeaffbdda64be1ed32cbcb451b20cf666308 (diff)
QAbstractItemView: convert some assignments into RVO'ed initializations
Change-Id: If4b612460166675e91906a49e03de8ad4c50739f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 5b955a6e14..276e185457 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3016,9 +3016,8 @@ int QAbstractItemView::sizeHintForRow(int row) const
QStyleOptionViewItem option = d->viewOptionsV1();
int height = 0;
int colCount = d->model->columnCount(d->root);
- QModelIndex index;
for (int c = 0; c < colCount; ++c) {
- index = d->model->index(row, c, d->root);
+ const QModelIndex index = d->model->index(row, c, d->root);
if (QWidget *editor = d->editorForIndex(index).widget.data())
height = qMax(height, editor->height());
int hint = d->delegateForIndex(index)->sizeHint(option, index).height();
@@ -3047,9 +3046,8 @@ int QAbstractItemView::sizeHintForColumn(int column) const
QStyleOptionViewItem option = d->viewOptionsV1();
int width = 0;
int rows = d->model->rowCount(d->root);
- QModelIndex index;
for (int r = 0; r < rows; ++r) {
- index = d->model->index(r, column, d->root);
+ const QModelIndex index = d->model->index(r, column, d->root);
if (QWidget *editor = d->editorForIndex(index).widget.data())
width = qMax(width, editor->sizeHint().width());
int hint = d->delegateForIndex(index)->sizeHint(option, index).width();