summaryrefslogtreecommitdiffstats
path: root/examples/opengl
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-12-14 00:29:30 +0100
committerMarc Mutz <marc.mutz@kdab.com>2019-05-23 17:30:51 +0200
commitb4a88aa7589d9d09fd54a5a7df29036a74293116 (patch)
treed503c037f6113520eb59595cae35ba35dec28edf /examples/opengl
parent923e08132cfd0c9140e705a7f0f27b3432f94695 (diff)
examples: port away from Java-style iterators
There's no reason to use them here, the Mutable is misleading in a few instances, ranged-for is much simpler, and more future-proof. Change-Id: Ifd5eaae95bbaa0b4cf0f435e6cfee6d778817b44 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/legacy/overpainting/glwidget.cpp6
-rw-r--r--examples/opengl/qopenglwidget/glwidget.cpp7
2 files changed, 3 insertions, 10 deletions
diff --git a/examples/opengl/legacy/overpainting/glwidget.cpp b/examples/opengl/legacy/overpainting/glwidget.cpp
index f98d043c5c..0094f8ead7 100644
--- a/examples/opengl/legacy/overpainting/glwidget.cpp
+++ b/examples/opengl/legacy/overpainting/glwidget.cpp
@@ -247,12 +247,8 @@ void GLWidget::createBubbles(int number)
//! [13]
void GLWidget::animate()
{
- QMutableListIterator<Bubble*> iter(bubbles);
-
- while (iter.hasNext()) {
- Bubble *bubble = iter.next();
+ for (Bubble *bubble : qAsConst(bubbles))
bubble->move(rect());
- }
update();
}
//! [13]
diff --git a/examples/opengl/qopenglwidget/glwidget.cpp b/examples/opengl/qopenglwidget/glwidget.cpp
index 946b2bec67..5057291f12 100644
--- a/examples/opengl/qopenglwidget/glwidget.cpp
+++ b/examples/opengl/qopenglwidget/glwidget.cpp
@@ -399,12 +399,9 @@ void GLWidget::paintGL()
painter.end();
- QMutableListIterator<Bubble*> iter(m_bubbles);
-
- while (iter.hasNext()) {
- Bubble *bubble = iter.next();
+ for (Bubble *bubble : qAsConst(m_bubbles))
bubble->move(rect());
- }
+
if (!(m_frames % 100)) {
m_time.start();
m_frames = 0;