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 <ivan.solovev@qt.io> (cherry picked from commit ddcf716762e5100f56e23b4171f225ed1a97709c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
31bfd89f6c
commit
a2dfc69730
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user