summaryrefslogtreecommitdiffstats
path: root/examples/widgets/touch/fingerpaint
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-12-07 12:00:48 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-07 13:15:59 +0000
commit1f2c23a7ca1699b345578aeb52fbd97b612e079a (patch)
treef9c738188b43e737e51772ba3376f16aa2d76386 /examples/widgets/touch/fingerpaint
parentbec817334705d86bc4e99af2e7220bb877f036d3 (diff)
Cleanup Widgets examples - foreach
Cleanup the Widget examples - replace foreach with range-based for loop in subdirectory tools, touch and tutorials Change-Id: I008d23b5993a18a3332fe9f5e5bca68cb0561066 Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/touch/fingerpaint')
-rw-r--r--examples/widgets/touch/fingerpaint/mainwindow.cpp6
-rw-r--r--examples/widgets/touch/fingerpaint/scribblearea.cpp6
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/widgets/touch/fingerpaint/mainwindow.cpp b/examples/widgets/touch/fingerpaint/mainwindow.cpp
index b0d91d25bf..2f7ec38d1a 100644
--- a/examples/widgets/touch/fingerpaint/mainwindow.cpp
+++ b/examples/widgets/touch/fingerpaint/mainwindow.cpp
@@ -129,7 +129,8 @@ void MainWindow::createActions()
openAct->setShortcut(tr("Ctrl+O"));
connect(openAct, &QAction::triggered, this, &MainWindow::open);
- foreach (QByteArray format, QImageWriter::supportedImageFormats()) {
+ const QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats();
+ for (const QByteArray &format : imageFormats) {
QString text = tr("%1...").arg(QString(format).toUpper());
QAction *action = new QAction(text, this);
@@ -163,8 +164,7 @@ void MainWindow::createMenus()
//! [15] //! [16]
{
saveAsMenu = new QMenu(tr("&Save As"), this);
- foreach (QAction *action, saveAsActs)
- saveAsMenu->addAction(action);
+ saveAsMenu->addActions(saveAsActs);
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(openAct);
diff --git a/examples/widgets/touch/fingerpaint/scribblearea.cpp b/examples/widgets/touch/fingerpaint/scribblearea.cpp
index aa4e60c934..0b0c4476d9 100644
--- a/examples/widgets/touch/fingerpaint/scribblearea.cpp
+++ b/examples/widgets/touch/fingerpaint/scribblearea.cpp
@@ -195,9 +195,9 @@ bool ScribbleArea::event(QEvent *event)
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
{
- QTouchEvent *touch = static_cast<QTouchEvent *>(event);
- QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
- foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) {
+ const QTouchEvent *touch = static_cast<QTouchEvent *>(event);
+ const QList<QTouchEvent::TouchPoint> touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ for (const QTouchEvent::TouchPoint &touchPoint : touchPoints) {
switch (touchPoint.state()) {
case Qt::TouchPointStationary:
case Qt::TouchPointReleased: