diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-01 15:18:57 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-02-02 12:49:19 +0000 |
commit | df39627fa33392a71ab79aadaa57e5c5e650e79e (patch) | |
tree | 83a776716c9b8d9bea2e0a5c3282aa5e0cbcdb6d /examples/opengl | |
parent | 7847e6bc02552fa7fc7f518e5cb3336f667b5a6d (diff) |
Examples: cleanup foreach usage
Replace deprecated foreach macro with range-based for loop
Change-Id: If919ba1d1d4acddfc1c5460ce7aebf8c49e3ac38
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/opengl')
-rw-r--r-- | examples/opengl/contextinfo/widget.cpp | 2 | ||||
-rw-r--r-- | examples/opengl/legacy/overpainting/glwidget.cpp | 2 | ||||
-rw-r--r-- | examples/opengl/qopenglwidget/glwidget.cpp | 6 | ||||
-rw-r--r-- | examples/opengl/qopenglwidget/mainwindow.cpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp index a5d9e98bf8..b1b7076503 100644 --- a/examples/opengl/contextinfo/widget.cpp +++ b/examples/opengl/contextinfo/widget.cpp @@ -387,7 +387,7 @@ void Widget::renderWindowReady() QList<QByteArray> extensionList = context->extensions().toList(); std::sort(extensionList.begin(), extensionList.end()); m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count())); - Q_FOREACH (const QByteArray &ext, extensionList) + for (const QByteArray &ext : qAsConst(extensionList)) m_extensions->append(QString::fromLatin1(ext)); m_output->moveCursor(QTextCursor::Start); diff --git a/examples/opengl/legacy/overpainting/glwidget.cpp b/examples/opengl/legacy/overpainting/glwidget.cpp index 1ec7bd731c..f98d043c5c 100644 --- a/examples/opengl/legacy/overpainting/glwidget.cpp +++ b/examples/opengl/legacy/overpainting/glwidget.cpp @@ -201,7 +201,7 @@ void GLWidget::paintEvent(QPaintEvent *event) //! [10] QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); - foreach (Bubble *bubble, bubbles) { + for (Bubble *bubble : qAsConst(bubbles)) { if (bubble->rect().intersects(event->rect())) bubble->drawBubble(&painter); } diff --git a/examples/opengl/qopenglwidget/glwidget.cpp b/examples/opengl/qopenglwidget/glwidget.cpp index 3fe919f94b..946b2bec67 100644 --- a/examples/opengl/qopenglwidget/glwidget.cpp +++ b/examples/opengl/qopenglwidget/glwidget.cpp @@ -385,10 +385,10 @@ void GLWidget::paintGL() painter.endNativePainting(); - if (m_showBubbles) - foreach (Bubble *bubble, m_bubbles) { + if (m_showBubbles) { + for (Bubble *bubble : qAsConst(m_bubbles)) bubble->drawBubble(&painter); - } + } if (const int elapsed = m_time.elapsed()) { QString framesPerSecond; diff --git a/examples/opengl/qopenglwidget/mainwindow.cpp b/examples/opengl/qopenglwidget/mainwindow.cpp index 4bd123628f..6fab3df79e 100644 --- a/examples/opengl/qopenglwidget/mainwindow.cpp +++ b/examples/opengl/qopenglwidget/mainwindow.cpp @@ -176,7 +176,7 @@ void MainWindow::timerUsageChanged(bool enabled) m_timer->start(); } else { m_timer->stop(); - foreach (QOpenGLWidget *w, m_glWidgets) + for (QOpenGLWidget *w : qAsConst(m_glWidgets)) w->update(); } } |