summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-05-05 10:49:56 +0200
committerMarc Mutz <marc.mutz@kdab.com>2020-05-05 15:34:15 +0200
commit4eba90c9228423c82729c8678b9737ecf79974d7 (patch)
treeb0056deb8828467eea20732a2fb90d39ff122266 /src/widgets/graphicsview
parent7db59f458b96342f762a0bd9f5218907c026019a (diff)
QGraphicsGridLayout: simplify a loop over Qt::Orientation values
Instead of selecting a Qt::Orientation value based on the integer loop variable, just loop over the possible Qt::Orientation values directly. Change-Id: I25b6f0d49c9b5a7e16e974dcc37668f801e65224 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp4
1 files changed, 1 insertions, 3 deletions
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;