diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-04 17:27:16 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-28 19:37:39 +0000 |
commit | 64b2eb7490f502feececec314eb215bbb7832858 (patch) | |
tree | 74cde25d3c12dbdc61647e2de986ba5ab8a36707 /examples/widgets/widgets/scribble | |
parent | f9e6f8efda350689211286db9154677924df8aab (diff) |
Cleanup Widgets examples - replace foreach
Cleanup the Widget examples - replace foreach with a standard for loop
Change-Id: I59cb2bf4494201f9f0228b07a8bb936ce40da46f
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/widgets/scribble')
-rw-r--r-- | examples/widgets/widgets/scribble/mainwindow.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/widgets/widgets/scribble/mainwindow.cpp b/examples/widgets/widgets/scribble/mainwindow.cpp index 58dc42c076..44afa64b94 100644 --- a/examples/widgets/widgets/scribble/mainwindow.cpp +++ b/examples/widgets/widgets/scribble/mainwindow.cpp @@ -153,8 +153,9 @@ void MainWindow::createActions() openAct->setShortcuts(QKeySequence::Open); connect(openAct, &QAction::triggered, this, &MainWindow::open); - foreach (QByteArray format, QImageWriter::supportedImageFormats()) { - QString text = tr("%1...").arg(QString(format).toUpper()); + const QList<QByteArray> imageFormats = QImageWriter::supportedImageFormats(); + for (const QByteArray &format : imageFormats) { + QString text = tr("%1...").arg(QString::fromLatin1(format).toUpper()); QAction *action = new QAction(text, this); action->setData(format); @@ -193,7 +194,7 @@ void MainWindow::createMenus() //! [15] //! [16] { saveAsMenu = new QMenu(tr("&Save As"), this); - foreach (QAction *action, saveAsActs) + for (QAction *action : qAsConst(saveAsActs)) saveAsMenu->addAction(action); fileMenu = new QMenu(tr("&File"), this); |