QtNetwork: eradicate Q_FOREACH loops [const-& returns]

... by replacing them with C++11 range-for loops.

The function QObject::children() returns by const-reference,
so its result can be passed to range-for without further changes.

Change-Id: Ic330a8e110d6dd5624b9e328ece2a614d5c71e4f
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
Marc Mutz 2016-01-26 14:38:54 +01:00
parent bac6da10dd
commit db27f3d5a7

View File

@ -274,7 +274,7 @@ bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
// Is our parent a localServer? Then it wants us to use its remote socket.
QLocalServer* localServer = qobject_cast<QLocalServer*>( parent() );
if (localServer) {
foreach (QObject* child, localServer->children()) {
for (QObject* child : localServer->children()) {
QTcpSocket* childTcpSocket = qobject_cast<QTcpSocket*>(child);
if (childTcpSocket && childTcpSocket->socketDescriptor() == socketDescriptor) {
d->setSocket( static_cast<QLocalUnixSocket*>(childTcpSocket) );