From cb26a4da69db434d4227bc16e41187f3db93c984 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Fri, 7 Feb 2020 17:29:33 +0300 Subject: QAbstractSocket: deprecate 'error' signal, use 'errorOccurred' instead [ChangeLog][Deprecation Notice] QAbstractSocket::error() (the signal) is deprecated; superseded by errorOccurred() Change-Id: I11e9c774d7c6096d1e9b37c451cf0b99188b6aad Reviewed-by: Timur Pocheptsov --- examples/network/doc/src/fortuneclient.qdoc | 6 +++--- examples/network/fortuneclient/client.cpp | 2 +- examples/network/loopback/dialog.cpp | 5 ++--- examples/network/network-chat/client.cpp | 3 +-- examples/network/torrent/peerwireclient.cpp | 4 ++-- examples/network/torrent/torrentclient.cpp | 2 +- examples/network/torrent/torrentserver.cpp | 2 +- 7 files changed, 11 insertions(+), 13 deletions(-) (limited to 'examples/network') diff --git a/examples/network/doc/src/fortuneclient.qdoc b/examples/network/doc/src/fortuneclient.qdoc index 544fa156b7..4cb7544fc0 100644 --- a/examples/network/doc/src/fortuneclient.qdoc +++ b/examples/network/doc/src/fortuneclient.qdoc @@ -89,7 +89,7 @@ The only QTcpSocket signals we need in this example are QTcpSocket::readyRead(), signifying that data has been received, and - QTcpSocket::error(), which we will use to catch any connection errors: + QTcpSocket::errorOccurred(), which we will use to catch any connection errors: \dots \snippet fortuneclient/client.cpp 3 @@ -118,11 +118,11 @@ \li \e{An error occurs.} We need to inform the user if the connection failed or was broken. In this case, QTcpSocket will emit - \l{QTcpSocket::error()}{error()}, and \c Client::displayError() will be + \l{QTcpSocket::errorOccurred()}{errorOccurred()}, and \c Client::displayError() will be called. \endlist - Let's go through the \l{QTcpSocket::error()}{error()} case first: + Let's go through the \l{QTcpSocket::errorOccurred()}{errorOccurred()} case first: \snippet fortuneclient/client.cpp 13 diff --git a/examples/network/fortuneclient/client.cpp b/examples/network/fortuneclient/client.cpp index 0ccbf51df8..2daac33c2b 100644 --- a/examples/network/fortuneclient/client.cpp +++ b/examples/network/fortuneclient/client.cpp @@ -121,7 +121,7 @@ Client::Client(QWidget *parent) //! [2] //! [3] connect(tcpSocket, &QIODevice::readyRead, this, &Client::readFortune); //! [2] //! [4] - connect(tcpSocket, QOverload::of(&QAbstractSocket::error), + connect(tcpSocket, &QAbstractSocket::errorOccurred, //! [3] this, &Client::displayError); //! [4] diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp index d87f024031..4037f4c085 100644 --- a/examples/network/loopback/dialog.cpp +++ b/examples/network/loopback/dialog.cpp @@ -78,7 +78,7 @@ Dialog::Dialog(QWidget *parent) connect(&tcpClient, &QAbstractSocket::connected, this, &Dialog::startTransfer); connect(&tcpClient, &QIODevice::bytesWritten, this, &Dialog::updateClientProgress); - connect(&tcpClient, QOverload::of(&QAbstractSocket::error), + connect(&tcpClient, &QAbstractSocket::errorOccurred, this, &Dialog::displayError); QVBoxLayout *mainLayout = new QVBoxLayout; @@ -131,8 +131,7 @@ void Dialog::acceptConnection() connect(tcpServerConnection, &QIODevice::readyRead, this, &Dialog::updateServerProgress); - connect(tcpServerConnection, - QOverload::of(&QAbstractSocket::error), + connect(tcpServerConnection, &QAbstractSocket::errorOccurred, this, &Dialog::displayError); connect(tcpServerConnection, &QTcpSocket::disconnected, tcpServerConnection, &QTcpSocket::deleteLater); diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp index d451181813..fe35d535f4 100644 --- a/examples/network/network-chat/client.cpp +++ b/examples/network/network-chat/client.cpp @@ -102,8 +102,7 @@ void Client::newConnection(Connection *connection) { connection->setGreetingMessage(peerManager->userName()); - connect(connection, QOverload::of(&Connection::error), - this, &Client::connectionError); + connect(connection, &Connection::errorOccurred, this, &Client::connectionError); connect(connection, &Connection::disconnected, this, &Client::disconnected); connect(connection, &Connection::readyForUse, this, &Client::readyForUse); } diff --git a/examples/network/torrent/peerwireclient.cpp b/examples/network/torrent/peerwireclient.cpp index cea4ef53fa..c30abd0e13 100644 --- a/examples/network/torrent/peerwireclient.cpp +++ b/examples/network/torrent/peerwireclient.cpp @@ -107,8 +107,8 @@ PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent) this, &PeerWireClient::readyRead); connect(&socket, &QTcpSocket::disconnected, this, &PeerWireClient::disconnected); - connect(&socket, QOverload::of(&QTcpSocket::error), - this, QOverload::of(&PeerWireClient::error)); + connect(&socket, &QTcpSocket::errorOccurred, + this, &PeerWireClient::errorOccurred); connect(&socket, &QTcpSocket::bytesWritten, this, &PeerWireClient::bytesWritten); connect(&socket, &QTcpSocket::stateChanged, diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp index 6b11338f42..2ba4476861 100644 --- a/examples/network/torrent/torrentclient.cpp +++ b/examples/network/torrent/torrentclient.cpp @@ -843,7 +843,7 @@ void TorrentClient::initializeConnection(PeerWireClient *client) this, &TorrentClient::setupOutgoingConnection); connect(client, &PeerWireClient::disconnected, this, &TorrentClient::removeClient); - connect(client, QOverload::of(&PeerWireClient::error), + connect(client, &PeerWireClient::errorOccurred, this, &TorrentClient::removeClient); connect(client, &PeerWireClient::piecesAvailable, this, &TorrentClient::peerPiecesAvailable); diff --git a/examples/network/torrent/torrentserver.cpp b/examples/network/torrent/torrentserver.cpp index 215498194b..7af958c27c 100644 --- a/examples/network/torrent/torrentserver.cpp +++ b/examples/network/torrent/torrentserver.cpp @@ -80,7 +80,7 @@ void TorrentServer::incomingConnection(qintptr socketDescriptor) if (ConnectionManager::instance()->canAddConnection() && !clients.isEmpty()) { connect(client, &PeerWireClient::infoHashReceived, this, &TorrentServer::processInfoHash); - connect(client, QOverload::of(&PeerWireClient::error), + connect(client, &PeerWireClient::errorOccurred, this, QOverload<>::of(&TorrentServer::removeClient)); RateController::instance()->addSocket(client); ConnectionManager::instance()->addConnection(client); -- cgit v1.2.3