From a2c18fd10ca046b52d701e1bfe6e456d6cabec50 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 31 Jul 2019 13:12:47 +0300 Subject: tst_QMenu: Eradicate Q_FOREACH loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In two cases, we now detach. ¯\_(ツ)_/¯ This is test code. Change-Id: I244f5e20dd923281049f38b76366163c16b6498c Reviewed-by: Friedemann Kleint --- tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp') diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 3bfbe754ef..4f5a2ce1a6 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -610,7 +610,7 @@ void tst_QMenu::widgetActionFocus() static QMenu *getTornOffMenu() { - foreach (QWidget *w, QApplication::allWidgets()) { + for (QWidget *w : QApplication::allWidgets()) { if (w->isVisible() && w->inherits("QTornOffMenu")) return static_cast(w); } @@ -948,8 +948,7 @@ void tst_QMenu::menuSizeHint() { QMenu menu; //this is a list of arbitrary strings so that we check the geometry - QStringList list = QStringList() << "trer" << "ezrfgtgvqd" << "sdgzgzerzerzer" << "eerzertz" << "er"; - foreach (QString str, list) + for (auto str : {"trer", "ezrfgtgvqd", "sdgzgzerzerzer", "eerzertz", "er"}) menu.addAction(str); int left, top, right, bottom; @@ -960,7 +959,7 @@ void tst_QMenu::menuSizeHint() int maxWidth =0; QRect result; - foreach (QAction *action, menu.actions()) { + for (QAction *action : menu.actions()) { maxWidth = qMax(maxWidth, menu.actionGeometry(action).width()); result |= menu.actionGeometry(action); QCOMPARE(result.x(), left + hmargin + panelWidth); -- cgit v1.2.3