use loop-local variables in qt_qFindChildren_helper() functions

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-01-08 01:13:09 +00:00
parent 28afb68973
commit 1435a6a292

View file

@ -1421,15 +1421,12 @@ void qt_qFindChildren_helper(const QObject *parent, const QString &name, const Q
if (!parent || !list)
return;
const QObjectList &children = parent->children();
QObject *obj;
for (int i = 0; i < children.size(); ++i) {
obj = children.at(i);
QObject *obj = children.at(i);
if (mo.cast(obj)) {
if (re) {
if (re->indexIn(obj->objectName()) != -1)
if (re && re->indexIn(obj->objectName()) != -1) {
list->append(obj);
} else {
if (name.isNull() || obj->objectName() == name)
} else if (name.isNull() || obj->objectName() == name) {
list->append(obj);
}
}
@ -1444,15 +1441,13 @@ QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const
if (!parent)
return Q_NULLPTR;
const QObjectList &children = parent->children();
QObject *obj;
int i;
for (i = 0; i < children.size(); ++i) {
obj = children.at(i);
for (int i = 0; i < children.size(); ++i) {
QObject *obj = children.at(i);
if (mo.cast(obj) && (name.isNull() || obj->objectName() == name))
return obj;
}
for (i = 0; i < children.size(); ++i) {
obj = qt_qFindChild_helper(children.at(i), name, mo);
for (int i = 0; i < children.size(); ++i) {
QObject *obj = qt_qFindChild_helper(children.at(i), name, mo);
if (obj)
return obj;
}