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:
parent
bac6da10dd
commit
db27f3d5a7
@ -274,7 +274,7 @@ bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
|
|||||||
// Is our parent a localServer? Then it wants us to use its remote socket.
|
// Is our parent a localServer? Then it wants us to use its remote socket.
|
||||||
QLocalServer* localServer = qobject_cast<QLocalServer*>( parent() );
|
QLocalServer* localServer = qobject_cast<QLocalServer*>( parent() );
|
||||||
if (localServer) {
|
if (localServer) {
|
||||||
foreach (QObject* child, localServer->children()) {
|
for (QObject* child : localServer->children()) {
|
||||||
QTcpSocket* childTcpSocket = qobject_cast<QTcpSocket*>(child);
|
QTcpSocket* childTcpSocket = qobject_cast<QTcpSocket*>(child);
|
||||||
if (childTcpSocket && childTcpSocket->socketDescriptor() == socketDescriptor) {
|
if (childTcpSocket && childTcpSocket->socketDescriptor() == socketDescriptor) {
|
||||||
d->setSocket( static_cast<QLocalUnixSocket*>(childTcpSocket) );
|
d->setSocket( static_cast<QLocalUnixSocket*>(childTcpSocket) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user