diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-07 11:59:02 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-23 18:49:02 +0000 |
commit | 26f7edb09eaf66590de9a3603489464fd868eedc (patch) | |
tree | b49374b0649421072494150d7ec6ff84f43fa051 /examples/widgets/graphicsview/collidingmice | |
parent | bce32c8ab8c547d0fc9d12d192546dde361443fa (diff) | |
download | qtbase-26f7edb09eaf66590de9a3603489464fd868eedc.tar.gz |
Cleanup Widgets examples - foreach
Cleanup the Widgets examples - replace foreach with range-based for loop
in graphicsview subdirectory
Change-Id: I9093b3ae89d73d0b860d29929943881c90074bce
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/graphicsview/collidingmice')
-rw-r--r-- | examples/widgets/graphicsview/collidingmice/mouse.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/widgets/graphicsview/collidingmice/mouse.cpp b/examples/widgets/graphicsview/collidingmice/mouse.cpp index 14f887f6e3..a8fcc05d76 100644 --- a/examples/widgets/graphicsview/collidingmice/mouse.cpp +++ b/examples/widgets/graphicsview/collidingmice/mouse.cpp @@ -160,11 +160,12 @@ void Mouse::advance(int step) // Try not to crash with any other mice //! [7] - QList<QGraphicsItem *> dangerMice = scene()->items(QPolygonF() - << mapToScene(0, 0) - << mapToScene(-30, -50) - << mapToScene(30, -50)); - foreach (QGraphicsItem *item, dangerMice) { + const QList<QGraphicsItem *> dangerMice = scene()->items(QPolygonF() + << mapToScene(0, 0) + << mapToScene(-30, -50) + << mapToScene(30, -50)); + + for (const QGraphicsItem *item : dangerMice) { if (item == this) continue; |