summaryrefslogtreecommitdiffstats
path: root/examples/network/threadedfortuneserver/dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/threadedfortuneserver/dialog.cpp')
-rw-r--r--examples/network/threadedfortuneserver/dialog.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/network/threadedfortuneserver/dialog.cpp b/examples/network/threadedfortuneserver/dialog.cpp
index 675f5d6520..9449cab5fa 100644
--- a/examples/network/threadedfortuneserver/dialog.cpp
+++ b/examples/network/threadedfortuneserver/dialog.cpp
@@ -26,12 +26,12 @@ Dialog::Dialog(QWidget *parent)
}
QString ipAddress;
- QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
+ const QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
// use the first non-localhost IPv4 address
- for (int i = 0; i < ipAddressesList.size(); ++i) {
- if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
- ipAddressesList.at(i).toIPv4Address()) {
- ipAddress = ipAddressesList.at(i).toString();
+
+ for (const QHostAddress &entry : ipAddressesList) {
+ if (entry != QHostAddress::LocalHost && entry.toIPv4Address()) {
+ ipAddress = entry.toString();
break;
}
}