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>
bb10
Marc Mutz 2020-05-05 10:49:56 +02:00
parent 7db59f458b
commit 4eba90c922
1 changed files with 1 additions and 3 deletions

View File

@ -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;