summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-31 13:12:47 +0300
committerMarc Mutz <marc.mutz@kdab.com>2019-08-01 07:46:36 +0300
commita2c18fd10ca046b52d701e1bfe6e456d6cabec50 (patch)
tree7f126e19888ae7026e46225ebc0565746f07c6a8 /tests/auto/widgets/widgets
parent6e8dd46a6f4e81617f69c5ba4eca0a74b548290a (diff)
tst_QMenu: Eradicate Q_FOREACH loops
In two cases, we now detach. ¯\_(ツ)_/¯ This is test code. Change-Id: I244f5e20dd923281049f38b76366163c16b6498c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp7
1 files changed, 3 insertions, 4 deletions
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<QMenu *>(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);