diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-07 11:58:03 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-01-23 18:48:59 +0000 |
commit | bce32c8ab8c547d0fc9d12d192546dde361443fa (patch) | |
tree | 8a9a3a8e043bd68de8c7de242d58c207ea77e1db /examples/widgets/mainwindows/mainwindow/colorswatch.cpp | |
parent | 770b4afeed37ddf036dcbc287b68f9f7b151af27 (diff) |
Cleanup Widgets examples - foreach
Cleanup the Widgets examples - replace foreach with range-based for loop
in mainwindows and painting subdirectories
Change-Id: I3c1556dffd22e29dd0a5ba960e699291c496278a
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'examples/widgets/mainwindows/mainwindow/colorswatch.cpp')
-rw-r--r-- | examples/widgets/mainwindows/mainwindow/colorswatch.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp index 240a04c897..4e4c15ccaf 100644 --- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp +++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp @@ -454,8 +454,8 @@ void ColorSwatch::updateContextMenu() tabMenu->clear(); splitHMenu->clear(); splitVMenu->clear(); - QList<ColorSwatch*> dock_list = mainWindow->findChildren<ColorSwatch*>(); - foreach (ColorSwatch *dock, dock_list) { + const QList<ColorSwatch *> dockList = mainWindow->findChildren<ColorSwatch*>(); + for (const ColorSwatch *dock : dockList) { tabMenu->addAction(dock->objectName()); splitHMenu->addAction(dock->objectName()); splitVMenu->addAction(dock->objectName()); @@ -464,7 +464,8 @@ void ColorSwatch::updateContextMenu() static ColorSwatch *findByName(const QMainWindow *mainWindow, const QString &name) { - foreach (ColorSwatch *dock, mainWindow->findChildren<ColorSwatch*>()) { + const QList<ColorSwatch *> dockList = mainWindow->findChildren<ColorSwatch*>(); + for (ColorSwatch *dock : dockList) { if (name == dock->objectName()) return dock; } |