summaryrefslogtreecommitdiffstats
path: root/examples/network/network-chat/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/network-chat/client.cpp')
-rw-r--r--examples/network/network-chat/client.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp
index 97c2c44b6b..b76ef18238 100644
--- a/examples/network/network-chat/client.cpp
+++ b/examples/network/network-chat/client.cpp
@@ -71,8 +71,7 @@ void Client::sendMessage(const QString &message)
if (message.isEmpty())
return;
- QList<Connection *> connections = peers.values();
- foreach (Connection *connection, connections)
+ for (Connection *connection : qAsConst(peers))
connection->sendMessage(message);
}
@@ -90,8 +89,8 @@ bool Client::hasConnection(const QHostAddress &senderIp, int senderPort) const
if (!peers.contains(senderIp))
return false;
- QList<Connection *> connections = peers.values(senderIp);
- foreach (Connection *connection, connections) {
+ const QList<Connection *> connections = peers.values(senderIp);
+ for (const Connection *connection : connections) {
if (connection->peerPort() == senderPort)
return true;
}