From a2dfc69730f8003843d9cfbc1fed91a4d4adde3e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Aug 2023 11:13:11 +0200 Subject: [PATCH] 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). Task-number: QTBUG-115803 Change-Id: I9c5dcb2aefc433a1dead55dab669e645b6906963 Reviewed-by: Ivan Solovev (cherry picked from commit ddcf716762e5100f56e23b4171f225ed1a97709c) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index 065310398c9..0a182e896f0 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));