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 <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-08-05 11:13:11 +02:00
parent e0c1ae09fd
commit ddcf716762

View File

@ -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<QWidget *>(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<QWidget *>(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<QWidget *>(object)) {
QVERIFY(!widget->isEnabled());
QVERIFY(!widget->testAttribute(Qt::WA_ForceDisabled));