diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp index 260e1861c7..79cba74a93 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp @@ -587,9 +587,7 @@ void QGraphicsGridLayout::removeAt(int index) d->engine.removeItem(gridItem); // recalculate rowInfo.count if we remove an item that is on the right/bottommost row - for (int j = 0; j < NOrientations; ++j) { - // 0: Hor, 1: Ver - const Qt::Orientation orient = (j == 0 ? Qt::Horizontal : Qt::Vertical); + for (const Qt::Orientation orient : {Qt::Horizontal, Qt::Vertical}) { const int oldCount = d->engine.rowCount(orient); if (gridItem->lastRow(orient) == oldCount - 1) { const int newCount = d->engine.effectiveLastRow(orient) + 1;