From ddcf716762e5100f56e23b4171f225ed1a97709c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Aug 2023 11:13:11 +0200 Subject: tst_QGroupBox: port away from Q_FOREACH These are all simple: QObject::children() returns a reference-to-const QList, so we can leave the calls in the for loop (no detach()ing). The loop bodies also clearly don't modify the list of the QObject children (they're just QVERIFYs). Pick-to: 6.6 6.5 Task-number: QTBUG-115803 Change-Id: I9c5dcb2aefc433a1dead55dab669e645b6906963 Reviewed-by: Ivan Solovev --- tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/widgets/widgets/qgroupbox') diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index 065310398c..0a182e896f 100644 --- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp @@ -430,7 +430,7 @@ void tst_QGroupBox::childrenAreDisabled() layout->addWidget(new QRadioButton); box.setLayout(layout); - foreach (QObject *object, box.children()) { + for (QObject *object : box.children()) { if (QWidget *widget = qobject_cast(object)) { QVERIFY(!widget->isEnabled()); QVERIFY(!widget->testAttribute(Qt::WA_ForceDisabled)); @@ -438,7 +438,7 @@ void tst_QGroupBox::childrenAreDisabled() } box.setChecked(true); - foreach (QObject *object, box.children()) { + for (QObject *object : box.children()) { if (QWidget *widget = qobject_cast(object)) { QVERIFY(widget->isEnabled()); QVERIFY(!widget->testAttribute(Qt::WA_ForceDisabled)); @@ -446,7 +446,7 @@ void tst_QGroupBox::childrenAreDisabled() } box.setChecked(false); - foreach (QObject *object, box.children()) { + for (QObject *object : box.children()) { if (QWidget *widget = qobject_cast(object)) { QVERIFY(!widget->isEnabled()); QVERIFY(!widget->testAttribute(Qt::WA_ForceDisabled)); -- cgit v1.2.3