diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-11-01 13:21:32 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-11-06 10:57:23 +0100 |
commit | e85de7d787498624020884ef2e269c15faf76b50 (patch) | |
tree | 30044fb755fdf0c3015b21a14a1fa871526632a9 /examples/network/network-chat/client.cpp | |
parent | 66b6e28c0158b8c4e96ddf08908a538d865ce63a (diff) |
Cleanup network examples
Cleanup network examples:
- use nullptr
- use member-init
- adjust includes
- use new-style connects
Change-Id: I80aa230168e5aec88a1bc93bbf49a471bfc30e7b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'examples/network/network-chat/client.cpp')
-rw-r--r-- | examples/network/network-chat/client.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp index b76ef18238..d451181813 100644 --- a/examples/network/network-chat/client.cpp +++ b/examples/network/network-chat/client.cpp @@ -60,10 +60,10 @@ Client::Client() peerManager->setServerPort(server.serverPort()); peerManager->startBroadcasting(); - QObject::connect(peerManager, SIGNAL(newConnection(Connection*)), - this, SLOT(newConnection(Connection*))); - QObject::connect(&server, SIGNAL(newConnection(Connection*)), - this, SLOT(newConnection(Connection*))); + connect(peerManager, &PeerManager::newConnection, + this, &Client::newConnection); + connect(&server, &Server::newConnection, + this, &Client::newConnection); } void Client::sendMessage(const QString &message) @@ -102,10 +102,10 @@ void Client::newConnection(Connection *connection) { connection->setGreetingMessage(peerManager->userName()); - connect(connection, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(connectionError(QAbstractSocket::SocketError))); - connect(connection, SIGNAL(disconnected()), this, SLOT(disconnected())); - connect(connection, SIGNAL(readyForUse()), this, SLOT(readyForUse())); + connect(connection, QOverload<QAbstractSocket::SocketError>::of(&Connection::error), + this, &Client::connectionError); + connect(connection, &Connection::disconnected, this, &Client::disconnected); + connect(connection, &Connection::readyForUse, this, &Client::readyForUse); } void Client::readyForUse() @@ -115,8 +115,8 @@ void Client::readyForUse() connection->peerPort())) return; - connect(connection, SIGNAL(newMessage(QString,QString)), - this, SIGNAL(newMessage(QString,QString))); + connect(connection, &Connection::newMessage, + this, &Client::newMessage); peers.insert(connection->peerAddress(), connection); QString nick = connection->name(); |