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 <timur.pocheptsov@qt.io>
This commit is contained in:
Alexander Akulich 2020-02-07 17:29:33 +03:00 committed by Timur Pocheptsov
parent 469c333840
commit cb26a4da69
29 changed files with 103 additions and 89 deletions

View File

@ -89,7 +89,7 @@
The only QTcpSocket signals we need in this example are The only QTcpSocket signals we need in this example are
QTcpSocket::readyRead(), signifying that data has been received, and 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 \dots
\snippet fortuneclient/client.cpp 3 \snippet fortuneclient/client.cpp 3
@ -118,11 +118,11 @@
\li \e{An error occurs.} We need to inform the user if the connection \li \e{An error occurs.} We need to inform the user if the connection
failed or was broken. In this case, QTcpSocket will emit 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. called.
\endlist \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 \snippet fortuneclient/client.cpp 13

View File

@ -121,7 +121,7 @@ Client::Client(QWidget *parent)
//! [2] //! [3] //! [2] //! [3]
connect(tcpSocket, &QIODevice::readyRead, this, &Client::readFortune); connect(tcpSocket, &QIODevice::readyRead, this, &Client::readFortune);
//! [2] //! [4] //! [2] //! [4]
connect(tcpSocket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), connect(tcpSocket, &QAbstractSocket::errorOccurred,
//! [3] //! [3]
this, &Client::displayError); this, &Client::displayError);
//! [4] //! [4]

View File

@ -78,7 +78,7 @@ Dialog::Dialog(QWidget *parent)
connect(&tcpClient, &QAbstractSocket::connected, this, &Dialog::startTransfer); connect(&tcpClient, &QAbstractSocket::connected, this, &Dialog::startTransfer);
connect(&tcpClient, &QIODevice::bytesWritten, connect(&tcpClient, &QIODevice::bytesWritten,
this, &Dialog::updateClientProgress); this, &Dialog::updateClientProgress);
connect(&tcpClient, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), connect(&tcpClient, &QAbstractSocket::errorOccurred,
this, &Dialog::displayError); this, &Dialog::displayError);
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
@ -131,8 +131,7 @@ void Dialog::acceptConnection()
connect(tcpServerConnection, &QIODevice::readyRead, connect(tcpServerConnection, &QIODevice::readyRead,
this, &Dialog::updateServerProgress); this, &Dialog::updateServerProgress);
connect(tcpServerConnection, connect(tcpServerConnection, &QAbstractSocket::errorOccurred,
QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
this, &Dialog::displayError); this, &Dialog::displayError);
connect(tcpServerConnection, &QTcpSocket::disconnected, connect(tcpServerConnection, &QTcpSocket::disconnected,
tcpServerConnection, &QTcpSocket::deleteLater); tcpServerConnection, &QTcpSocket::deleteLater);

View File

@ -102,8 +102,7 @@ void Client::newConnection(Connection *connection)
{ {
connection->setGreetingMessage(peerManager->userName()); connection->setGreetingMessage(peerManager->userName());
connect(connection, QOverload<QAbstractSocket::SocketError>::of(&Connection::error), connect(connection, &Connection::errorOccurred, this, &Client::connectionError);
this, &Client::connectionError);
connect(connection, &Connection::disconnected, this, &Client::disconnected); connect(connection, &Connection::disconnected, this, &Client::disconnected);
connect(connection, &Connection::readyForUse, this, &Client::readyForUse); connect(connection, &Connection::readyForUse, this, &Client::readyForUse);
} }

View File

@ -107,8 +107,8 @@ PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent)
this, &PeerWireClient::readyRead); this, &PeerWireClient::readyRead);
connect(&socket, &QTcpSocket::disconnected, connect(&socket, &QTcpSocket::disconnected,
this, &PeerWireClient::disconnected); this, &PeerWireClient::disconnected);
connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error), connect(&socket, &QTcpSocket::errorOccurred,
this, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error)); this, &PeerWireClient::errorOccurred);
connect(&socket, &QTcpSocket::bytesWritten, connect(&socket, &QTcpSocket::bytesWritten,
this, &PeerWireClient::bytesWritten); this, &PeerWireClient::bytesWritten);
connect(&socket, &QTcpSocket::stateChanged, connect(&socket, &QTcpSocket::stateChanged,

View File

@ -843,7 +843,7 @@ void TorrentClient::initializeConnection(PeerWireClient *client)
this, &TorrentClient::setupOutgoingConnection); this, &TorrentClient::setupOutgoingConnection);
connect(client, &PeerWireClient::disconnected, connect(client, &PeerWireClient::disconnected,
this, &TorrentClient::removeClient); this, &TorrentClient::removeClient);
connect(client, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error), connect(client, &PeerWireClient::errorOccurred,
this, &TorrentClient::removeClient); this, &TorrentClient::removeClient);
connect(client, &PeerWireClient::piecesAvailable, connect(client, &PeerWireClient::piecesAvailable,
this, &TorrentClient::peerPiecesAvailable); this, &TorrentClient::peerPiecesAvailable);

View File

@ -80,7 +80,7 @@ void TorrentServer::incomingConnection(qintptr socketDescriptor)
if (ConnectionManager::instance()->canAddConnection() && !clients.isEmpty()) { if (ConnectionManager::instance()->canAddConnection() && !clients.isEmpty()) {
connect(client, &PeerWireClient::infoHashReceived, connect(client, &PeerWireClient::infoHashReceived,
this, &TorrentServer::processInfoHash); this, &TorrentServer::processInfoHash);
connect(client, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error), connect(client, &PeerWireClient::errorOccurred,
this, QOverload<>::of(&TorrentServer::removeClient)); this, QOverload<>::of(&TorrentServer::removeClient));
RateController::instance()->addSocket(client); RateController::instance()->addSocket(client);
ConnectionManager::instance()->addConnection(client); ConnectionManager::instance()->addConnection(client);

View File

@ -324,7 +324,7 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port)
socket->setObjectName(QLatin1String("QFtpDTP Passive state socket")); socket->setObjectName(QLatin1String("QFtpDTP Passive state socket"));
connect(socket, SIGNAL(connected()), SLOT(socketConnected())); connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError))); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed())); connect(socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed()));
connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64))); connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64)));
@ -769,7 +769,7 @@ void QFtpDTP::setupSocket()
socket->setObjectName(QLatin1String("QFtpDTP Active state socket")); socket->setObjectName(QLatin1String("QFtpDTP Active state socket"));
connect(socket, SIGNAL(connected()), SLOT(socketConnected())); connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError))); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed())); connect(socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed()));
connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64))); connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64)));
@ -807,7 +807,7 @@ QFtpPI::QFtpPI(QObject *parent) :
SLOT(connectionClosed())); SLOT(connectionClosed()));
connect(&commandSocket, SIGNAL(readyRead()), connect(&commandSocket, SIGNAL(readyRead()),
SLOT(readyRead())); SLOT(readyRead()));
connect(&commandSocket, SIGNAL(error(QAbstractSocket::SocketError)), connect(&commandSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
SLOT(error(QAbstractSocket::SocketError))); SLOT(error(QAbstractSocket::SocketError)));
connect(&dtp, SIGNAL(connectState(int)), connect(&dtp, SIGNAL(connectState(int)),

View File

@ -157,7 +157,7 @@ void QHttpNetworkConnectionChannel::init()
QObject::connect(socket, SIGNAL(disconnected()), QObject::connect(socket, SIGNAL(disconnected()),
this, SLOT(_q_disconnected()), this, SLOT(_q_disconnected()),
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), QObject::connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(_q_error(QAbstractSocket::SocketError)), this, SLOT(_q_error(QAbstractSocket::SocketError)),
Qt::DirectConnection); Qt::DirectConnection);

View File

@ -98,7 +98,7 @@ void QNetworkAccessDebugPipeBackend::open()
// socket ready read -> we can push from socket to downstream // socket ready read -> we can push from socket to downstream
connect(&socket, SIGNAL(readyRead()), SLOT(socketReadyRead())); connect(&socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError())); connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), SLOT(socketError()));
connect(&socket, SIGNAL(disconnected()), SLOT(socketDisconnected())); connect(&socket, SIGNAL(disconnected()), SLOT(socketDisconnected()));
connect(&socket, SIGNAL(connected()), SLOT(socketConnected())); connect(&socket, SIGNAL(connected()), SLOT(socketConnected()));
// socket bytes written -> we can push more from upstream to socket // socket bytes written -> we can push more from upstream to socket

View File

@ -84,7 +84,7 @@
HostLookupState. If the host is found, QAbstractSocket enters HostLookupState. If the host is found, QAbstractSocket enters
ConnectingState and emits the hostFound() signal. When the ConnectingState and emits the hostFound() signal. When the
connection has been established, it enters ConnectedState and connection has been established, it enters ConnectedState and
emits connected(). If an error occurs at any stage, error() is emits connected(). If an error occurs at any stage, errorOccurred() is
emitted. Whenever the state changes, stateChanged() is emitted. emitted. Whenever the state changes, stateChanged() is emitted.
For convenience, isValid() returns \c true if the socket is ready for For convenience, isValid() returns \c true if the socket is ready for
reading and writing, but note that the socket's state must be reading and writing, but note that the socket's state must be
@ -113,7 +113,7 @@
QAbstractSocket::UnconnectedState, and emits disconnected(). If you want QAbstractSocket::UnconnectedState, and emits disconnected(). If you want
to abort a connection immediately, discarding all pending data, call to abort a connection immediately, discarding all pending data, call
abort() instead. If the remote host closes the connection, abort() instead. If the remote host closes the connection,
QAbstractSocket will emit error(QAbstractSocket::RemoteHostClosedError), QAbstractSocket will emit errorOccurred(QAbstractSocket::RemoteHostClosedError),
during which the socket state will still be ConnectedState, and then the during which the socket state will still be ConnectedState, and then the
disconnected() signal will be emitted. disconnected() signal will be emitted.
@ -203,6 +203,14 @@
/*! /*!
\fn void QAbstractSocket::error(QAbstractSocket::SocketError socketError) \fn void QAbstractSocket::error(QAbstractSocket::SocketError socketError)
\obsolete
Use errorOccurred() instead.
*/
/*!
\fn void QAbstractSocket::errorOccurred(QAbstractSocket::SocketError socketError)
\since 5.15
This signal is emitted after an error occurred. The \a socketError This signal is emitted after an error occurred. The \a socketError
parameter describes the type of error that occurred. parameter describes the type of error that occurred.
@ -330,6 +338,7 @@
\value UnknownSocketError An unidentified error occurred. \value UnknownSocketError An unidentified error occurred.
\sa QAbstractSocket::error() \sa QAbstractSocket::error()
\sa QAbstractSocket::errorOccurred()
*/ */
/*! /*!
@ -988,7 +997,7 @@ void QAbstractSocketPrivate::startConnectingByName(const QString &host)
} }
state = QAbstractSocket::UnconnectedState; state = QAbstractSocket::UnconnectedState;
emit q->error(socketError); emit q->errorOccurred(socketError);
emit q->stateChanged(state); emit q->stateChanged(state);
} }
@ -1047,7 +1056,7 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
state = QAbstractSocket::UnconnectedState; state = QAbstractSocket::UnconnectedState;
setError(QAbstractSocket::HostNotFoundError, QAbstractSocket::tr("Host not found")); setError(QAbstractSocket::HostNotFoundError, QAbstractSocket::tr("Host not found"));
emit q->stateChanged(state); emit q->stateChanged(state);
emit q->error(QAbstractSocket::HostNotFoundError); emit q->errorOccurred(QAbstractSocket::HostNotFoundError);
return; return;
} }
@ -1070,8 +1079,8 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
_q_testConnection(), this function takes the first address of the _q_testConnection(), this function takes the first address of the
pending addresses list and tries to connect to it. If the pending addresses list and tries to connect to it. If the
connection succeeds, QAbstractSocket will emit connection succeeds, QAbstractSocket will emit
connected(). Otherwise, error(ConnectionRefusedError) or connected(). Otherwise, errorOccurred(ConnectionRefusedError) or
error(SocketTimeoutError) is emitted. errorOccurred(SocketTimeoutError) is emitted.
*/ */
void QAbstractSocketPrivate::_q_connectToNextAddress() void QAbstractSocketPrivate::_q_connectToNextAddress()
{ {
@ -1101,7 +1110,7 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
// q->setErrorString(QAbstractSocket::tr("Connection refused")); // q->setErrorString(QAbstractSocket::tr("Connection refused"));
} }
emit q->stateChanged(state); emit q->stateChanged(state);
emit q->error(socketError); emit q->errorOccurred(socketError);
return; return;
} }
@ -1223,7 +1232,7 @@ void QAbstractSocketPrivate::_q_abortConnectionAttempt()
setError(QAbstractSocket::SocketTimeoutError, setError(QAbstractSocket::SocketTimeoutError,
QAbstractSocket::tr("Connection timed out")); QAbstractSocket::tr("Connection timed out"));
emit q->stateChanged(state); emit q->stateChanged(state);
emit q->error(socketError); emit q->errorOccurred(socketError);
} else { } else {
_q_connectToNextAddress(); _q_connectToNextAddress();
} }
@ -1430,14 +1439,14 @@ void QAbstractSocketPrivate::setError(QAbstractSocket::SocketError errorCode,
\internal \internal
Sets the socket error state to \c errorCode and \a errorString, Sets the socket error state to \c errorCode and \a errorString,
and emits the QAbstractSocket::error() signal. and emits the QAbstractSocket::errorOccurred() signal.
*/ */
void QAbstractSocketPrivate::setErrorAndEmit(QAbstractSocket::SocketError errorCode, void QAbstractSocketPrivate::setErrorAndEmit(QAbstractSocket::SocketError errorCode,
const QString &errorString) const QString &errorString)
{ {
Q_Q(QAbstractSocket); Q_Q(QAbstractSocket);
setError(errorCode, errorString); setError(errorCode, errorString);
emit q->error(errorCode); emit q->errorOccurred(errorCode);
} }
/*! \internal /*! \internal
@ -1456,6 +1465,9 @@ QAbstractSocket::QAbstractSocket(SocketType socketType,
: socketType == SctpSocket ? "Sctp" : "Unknown", &dd, parent); : socketType == SctpSocket ? "Sctp" : "Unknown", &dd, parent);
#endif #endif
d->socketType = socketType; d->socketType = socketType;
// Support the deprecated error() signal:
connect(this, &QAbstractSocket::errorOccurred, this, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error));
} }
/*! /*!
@ -1654,7 +1666,7 @@ bool QAbstractSocket::isValid() const
established, QAbstractSocket enters ConnectedState and established, QAbstractSocket enters ConnectedState and
emits connected(). emits connected().
At any point, the socket can emit error() to signal that an error At any point, the socket can emit errorOccurred() to signal that an error
occurred. occurred.
\a hostName may be an IP address in string form (e.g., \a hostName may be an IP address in string form (e.g.,

View File

@ -206,7 +206,11 @@ Q_SIGNALS:
void connected(); void connected();
void disconnected(); void disconnected();
void stateChanged(QAbstractSocket::SocketState); void stateChanged(QAbstractSocket::SocketState);
#if QT_DEPRECATED_SINCE(5,15)
QT_DEPRECATED_X("Use QAbstractSocket::errorOccurred(QAbstractSocket::SocketError) instead")
void error(QAbstractSocket::SocketError); void error(QAbstractSocket::SocketError);
#endif
void errorOccurred(QAbstractSocket::SocketError);
#ifndef QT_NO_NETWORKPROXY #ifndef QT_NO_NETWORKPROXY
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
#endif #endif

View File

@ -93,7 +93,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo
connect(d->socket, SIGNAL(bytesWritten(qint64)), connect(d->socket, SIGNAL(bytesWritten(qint64)),
this, SLOT(slotSocketBytesWritten()), this, SLOT(slotSocketBytesWritten()),
Qt::DirectConnection); Qt::DirectConnection);
connect(d->socket, SIGNAL(error(QAbstractSocket::SocketError)), connect(d->socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(slotSocketError(QAbstractSocket::SocketError)), this, SLOT(slotSocketError(QAbstractSocket::SocketError)),
Qt::DirectConnection); Qt::DirectConnection);
connect(d->socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), connect(d->socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),

View File

@ -132,14 +132,14 @@ private:
Q_DISABLE_COPY(QLocalSocket) Q_DISABLE_COPY(QLocalSocket)
#if defined(QT_LOCALSOCKET_TCP) #if defined(QT_LOCALSOCKET_TCP)
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState)) Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError)) Q_PRIVATE_SLOT(d_func(), void _q_errorOccurred(QAbstractSocket::SocketError))
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
Q_PRIVATE_SLOT(d_func(), void _q_canWrite()) Q_PRIVATE_SLOT(d_func(), void _q_canWrite())
Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed()) Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed())
Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &)) Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &))
#else #else
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState)) Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError)) Q_PRIVATE_SLOT(d_func(), void _q_errorOccurred(QAbstractSocket::SocketError))
Q_PRIVATE_SLOT(d_func(), void _q_connectToSocket()) Q_PRIVATE_SLOT(d_func(), void _q_connectToSocket())
Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt()) Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt())
#endif #endif

View File

@ -127,7 +127,7 @@ public:
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const; QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function); void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function);
void _q_stateChanged(QAbstractSocket::SocketState newState); void _q_stateChanged(QAbstractSocket::SocketState newState);
void _q_error(QAbstractSocket::SocketError newError); void _q_errorOccurred(QAbstractSocket::SocketError newError);
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
~QLocalSocketPrivate(); ~QLocalSocketPrivate();
void destroyPipeHandles(); void destroyPipeHandles();
@ -144,7 +144,7 @@ public:
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const; QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function); void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function);
void _q_stateChanged(QAbstractSocket::SocketState newState); void _q_stateChanged(QAbstractSocket::SocketState newState);
void _q_error(QAbstractSocket::SocketError newError); void _q_errorOccurred(QAbstractSocket::SocketError newError);
void _q_connectToSocket(); void _q_connectToSocket();
void _q_abortConnectionAttempt(); void _q_abortConnectionAttempt();
void cancelDelayedConnect(); void cancelDelayedConnect();

View File

@ -77,8 +77,8 @@ void QLocalSocketPrivate::setSocket(QLocalUnixSocket* socket)
q->connect(tcpSocket, SIGNAL(disconnected()), q, SIGNAL(disconnected())); q->connect(tcpSocket, SIGNAL(disconnected()), q, SIGNAL(disconnected()));
q->connect(tcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), q->connect(tcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
q, SLOT(_q_stateChanged(QAbstractSocket::SocketState))); q, SLOT(_q_stateChanged(QAbstractSocket::SocketState)));
q->connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), q->connect(tcpSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
q, SLOT(_q_error(QAbstractSocket::SocketError))); q, SLOT(_q_errorOccurred(QAbstractSocket::SocketError)));
q->connect(tcpSocket, SIGNAL(readChannelFinished()), q, SIGNAL(readChannelFinished())); q->connect(tcpSocket, SIGNAL(readChannelFinished()), q, SIGNAL(readChannelFinished()));
tcpSocket->setParent(q); tcpSocket->setParent(q);
} }
@ -88,7 +88,7 @@ qint64 QLocalSocketPrivate::skip(qint64 maxSize)
return tcpSocket->skip(maxSize); return tcpSocket->skip(maxSize);
} }
void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError) void QLocalSocketPrivate::_q_errorOccurred(QAbstractSocket::SocketError socketError)
{ {
Q_Q(QLocalSocket); Q_Q(QLocalSocket);
QString function = QLatin1String("QLocalSocket"); QString function = QLatin1String("QLocalSocket");

View File

@ -81,8 +81,8 @@ void QLocalSocketPrivate::init()
q->connect(&unixSocket, SIGNAL(disconnected()), q, SIGNAL(disconnected())); q->connect(&unixSocket, SIGNAL(disconnected()), q, SIGNAL(disconnected()));
q->connect(&unixSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), q->connect(&unixSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
q, SLOT(_q_stateChanged(QAbstractSocket::SocketState))); q, SLOT(_q_stateChanged(QAbstractSocket::SocketState)));
q->connect(&unixSocket, SIGNAL(error(QAbstractSocket::SocketError)), q->connect(&unixSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
q, SLOT(_q_error(QAbstractSocket::SocketError))); q, SLOT(_q_errorOccurred(QAbstractSocket::SocketError)));
q->connect(&unixSocket, SIGNAL(readChannelFinished()), q, SIGNAL(readChannelFinished())); q->connect(&unixSocket, SIGNAL(readChannelFinished()), q, SIGNAL(readChannelFinished()));
unixSocket.setParent(q); unixSocket.setParent(q);
} }
@ -92,7 +92,7 @@ qint64 QLocalSocketPrivate::skip(qint64 maxSize)
return unixSocket.skip(maxSize); return unixSocket.skip(maxSize);
} }
void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError) void QLocalSocketPrivate::_q_errorOccurred(QAbstractSocket::SocketError socketError)
{ {
Q_Q(QLocalSocket); Q_Q(QLocalSocket);
QString function = QLatin1String("QLocalSocket"); QString function = QLatin1String("QLocalSocket");

View File

@ -559,8 +559,8 @@ void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(data->controlSocket, SIGNAL(bytesWritten(qint64)), q, SLOT(_q_controlSocketBytesWritten()), QObject::connect(data->controlSocket, SIGNAL(bytesWritten(qint64)), q, SLOT(_q_controlSocketBytesWritten()),
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(data->controlSocket, SIGNAL(error(QAbstractSocket::SocketError)), QObject::connect(data->controlSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
q, SLOT(_q_controlSocketError(QAbstractSocket::SocketError)), q, SLOT(_q_controlSocketErrorOccurred(QAbstractSocket::SocketError)),
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(data->controlSocket, SIGNAL(disconnected()), q, SLOT(_q_controlSocketDisconnected()), QObject::connect(data->controlSocket, SIGNAL(disconnected()), q, SLOT(_q_controlSocketDisconnected()),
Qt::DirectConnection); Qt::DirectConnection);
@ -1056,7 +1056,7 @@ bool QSocks5SocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(d->data->controlSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_controlSocketBytesWritten()), QObject::connect(d->data->controlSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_controlSocketBytesWritten()),
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(d->data->controlSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_controlSocketError(QAbstractSocket::SocketError)), QObject::connect(d->data->controlSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(_q_controlSocketErrorOccurred(QAbstractSocket::SocketError)),
Qt::DirectConnection); Qt::DirectConnection);
QObject::connect(d->data->controlSocket, SIGNAL(disconnected()), this, SLOT(_q_controlSocketDisconnected()), QObject::connect(d->data->controlSocket, SIGNAL(disconnected()), this, SLOT(_q_controlSocketDisconnected()),
Qt::DirectConnection); Qt::DirectConnection);
@ -1231,7 +1231,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketBytesWritten()
} }
} }
void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketError error) void QSocks5SocketEnginePrivate::_q_controlSocketErrorOccurred(QAbstractSocket::SocketError error)
{ {
QSOCKS5_D_DEBUG << "controlSocketError" << error << data->controlSocket->errorString(); QSOCKS5_D_DEBUG << "controlSocketError" << error << data->controlSocket->errorString();

View File

@ -130,7 +130,7 @@ private:
Q_DISABLE_COPY_MOVE(QSocks5SocketEngine) Q_DISABLE_COPY_MOVE(QSocks5SocketEngine)
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketConnected()) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketConnected())
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketReadNotification()) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketReadNotification())
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketError(QAbstractSocket::SocketError)) Q_PRIVATE_SLOT(d_func(), void _q_controlSocketErrorOccurred(QAbstractSocket::SocketError))
#ifndef QT_NO_UDPSOCKET #ifndef QT_NO_UDPSOCKET
Q_PRIVATE_SLOT(d_func(), void _q_udpSocketReadNotification()) Q_PRIVATE_SLOT(d_func(), void _q_udpSocketReadNotification())
#endif #endif
@ -246,7 +246,7 @@ public:
void _q_controlSocketConnected(); void _q_controlSocketConnected();
void _q_controlSocketReadNotification(); void _q_controlSocketReadNotification();
void _q_controlSocketError(QAbstractSocket::SocketError); void _q_controlSocketErrorOccurred(QAbstractSocket::SocketError);
#ifndef QT_NO_UDPSOCKET #ifndef QT_NO_UDPSOCKET
void _q_udpSocketReadNotification(); void _q_udpSocketReadNotification();
#endif #endif

View File

@ -2535,7 +2535,7 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode)
q->connect(plainSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), q->connect(plainSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
q, SLOT(_q_stateChangedSlot(QAbstractSocket::SocketState)), q, SLOT(_q_stateChangedSlot(QAbstractSocket::SocketState)),
Qt::DirectConnection); Qt::DirectConnection);
q->connect(plainSocket, SIGNAL(error(QAbstractSocket::SocketError)), q->connect(plainSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
q, SLOT(_q_errorSlot(QAbstractSocket::SocketError)), q, SLOT(_q_errorSlot(QAbstractSocket::SocketError)),
Qt::DirectConnection); Qt::DirectConnection);
q->connect(plainSocket, SIGNAL(readyRead()), q->connect(plainSocket, SIGNAL(readyRead()),

View File

@ -1081,7 +1081,7 @@ private slots:
void acceptNewConnection() void acceptNewConnection()
{ {
serverSocket = server.nextPendingConnection(); serverSocket = server.nextPendingConnection();
connect(serverSocket, SIGNAL(error(QAbstractSocket::SocketError)), connect(serverSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(remoteHostClosed())); this, SLOT(remoteHostClosed()));
} }

View File

@ -674,7 +674,7 @@ private:
//qDebug() << "connectSocketSignals" << client; //qDebug() << "connectSocketSignals" << client;
connect(client.data(), SIGNAL(readyRead()), this, SLOT(readyReadSlot())); connect(client.data(), SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
connect(client.data(), SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot())); connect(client.data(), SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
connect(client.data(), SIGNAL(error(QAbstractSocket::SocketError)), connect(client.data(), SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(slotError(QAbstractSocket::SocketError))); this, SLOT(slotError(QAbstractSocket::SocketError)));
} }

View File

@ -270,7 +270,7 @@ void tst_QHttpSocketEngine::errorTest()
socket.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, hostname, port, username, username)); socket.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, hostname, port, username, username));
socket.connectToHost("0.1.2.3", 12345); socket.connectToHost("0.1.2.3", 12345);
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop())); &QTestEventLoop::instance(), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(30); QTestEventLoop::instance().enterLoop(30);
QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!QTestEventLoop::instance().timeout());

View File

@ -283,7 +283,7 @@ void tst_QSocks5SocketEngine::errorTest()
socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, hostname, port, username, username)); socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, hostname, port, username, username));
socket.connectToHost("0.1.2.3", 12345); socket.connectToHost("0.1.2.3", 12345);
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop())); &QTestEventLoop::instance(), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(10); QTestEventLoop::instance().enterLoop(10);
QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!QTestEventLoop::instance().timeout());
@ -753,7 +753,7 @@ void tst_QSocks5SocketEngine::downloadBigFile()
QTestEventLoop::instance().exitLoop(); QTestEventLoop::instance().exitLoop();
}); });
connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), connect(&socket, &QAbstractSocket::errorOccurred,
[&socket, &stopWatch] (QAbstractSocket::SocketError errorCode) [&socket, &stopWatch] (QAbstractSocket::SocketError errorCode)
{ {
qWarning().noquote().nospace() << QTest::currentTestFunction() qWarning().noquote().nospace() << QTest::currentTestFunction()
@ -1006,7 +1006,7 @@ void tst_QSocks5SocketEngine::incomplete()
connect(&socket, SIGNAL(connected()), connect(&socket, SIGNAL(connected()),
&QTestEventLoop::instance(), SLOT(exitLoop())); &QTestEventLoop::instance(), SLOT(exitLoop()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop())); &QTestEventLoop::instance(), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(70); QTestEventLoop::instance().enterLoop(70);
QVERIFY(!QTestEventLoop::instance().timeout()); QVERIFY(!QTestEventLoop::instance().timeout());

View File

@ -2019,14 +2019,14 @@ void tst_QTcpSocket::remoteCloseError()
QCOMPARE(clientSocket->bytesAvailable(), qint64(5)); QCOMPARE(clientSocket->bytesAvailable(), qint64(5));
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError"); qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
QSignalSpy errorSpy(clientSocket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy errorSpy(clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
QSignalSpy disconnectedSpy(clientSocket, SIGNAL(disconnected())); QSignalSpy disconnectedSpy(clientSocket, SIGNAL(disconnected()));
clientSocket->write("World"); clientSocket->write("World");
serverSocket->disconnectFromHost(); serverSocket->disconnectFromHost();
tmpSocket = clientSocket; tmpSocket = clientSocket;
connect(clientSocket, SIGNAL(error(QAbstractSocket::SocketError)), connect(clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(remoteCloseErrorSlot())); this, SLOT(remoteCloseErrorSlot()));
enterLoop(30); enterLoop(30);
@ -2079,7 +2079,7 @@ void tst_QTcpSocket::nestedEventLoopInErrorSlot()
{ {
QTcpSocket *socket = newSocket(); QTcpSocket *socket = newSocket();
QPointer<QTcpSocket> p(socket); QPointer<QTcpSocket> p(socket);
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(enterLoopSlot())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(enterLoopSlot()));
socket->connectToHost("hostnotfoundhostnotfound.qt-project.org", 9999); socket->connectToHost("hostnotfoundhostnotfound.qt-project.org", 9999);
enterLoop(30); enterLoop(30);
@ -2109,7 +2109,7 @@ void tst_QTcpSocket::connectToHostError()
QFETCH(int, port); QFETCH(int, port);
QFETCH(QAbstractSocket::SocketError, expectedError); QFETCH(QAbstractSocket::SocketError, expectedError);
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),[&](QAbstractSocket::SocketError socketError){ connect(socket, &QAbstractSocket::errorOccurred, [&](QAbstractSocket::SocketError socketError){
error = socketError; error = socketError;
}); });
socket->connectToHost(host, port); // no service running here, one suspects socket->connectToHost(host, port); // no service running here, one suspects
@ -2326,7 +2326,7 @@ void tst_QTcpSocket::abortiveClose()
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError"); qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
QSignalSpy readyReadSpy(clientSocket, SIGNAL(readyRead())); QSignalSpy readyReadSpy(clientSocket, SIGNAL(readyRead()));
QSignalSpy errorSpy(clientSocket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy errorSpy(clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
connect(clientSocket, SIGNAL(disconnected()), this, SLOT(exitLoopSlot())); connect(clientSocket, SIGNAL(disconnected()), this, SLOT(exitLoopSlot()));
QTimer::singleShot(0, this, SLOT(abortiveClose_abortSlot())); QTimer::singleShot(0, this, SLOT(abortiveClose_abortSlot()));
@ -2439,14 +2439,14 @@ void tst_QTcpSocket::connectionRefused()
QTcpSocket *socket = newSocket(); QTcpSocket *socket = newSocket();
QSignalSpy stateSpy(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState))); QSignalSpy stateSpy(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
QSignalSpy errorSpy(socket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy errorSpy(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop())); &QTestEventLoop::instance(), SLOT(exitLoop()));
socket->connectToHost(QtNetworkSettings::httpServerName(), 144); socket->connectToHost(QtNetworkSettings::httpServerName(), 144);
enterLoop(10); enterLoop(10);
disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), disconnect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
&QTestEventLoop::instance(), SLOT(exitLoop())); &QTestEventLoop::instance(), SLOT(exitLoop()));
QVERIFY2(!timeout(), "Network timeout"); QVERIFY2(!timeout(), "Network timeout");
@ -2773,7 +2773,7 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop()
// check that we get a proper error connecting to port 12346 // check that we get a proper error connecting to port 12346
// This testcase uses an event loop // This testcase uses an event loop
QTcpSocket socket; QTcpSocket socket;
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
socket.connectToHost(QtNetworkSettings::httpServerName(), 12346); socket.connectToHost(QtNetworkSettings::httpServerName(), 12346);
QTestEventLoop::instance().enterLoop(10); QTestEventLoop::instance().enterLoop(10);
@ -3209,7 +3209,7 @@ void tst_QTcpSocket::readNotificationsAfterBind()
QAbstractSocket socket(QAbstractSocket::TcpSocket, nullptr); QAbstractSocket socket(QAbstractSocket::TcpSocket, nullptr);
QVERIFY2(socket.bind(), "Bind error!"); QVERIFY2(socket.bind(), "Bind error!");
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy spyReadyRead(&socket, SIGNAL(readyRead())); QSignalSpy spyReadyRead(&socket, SIGNAL(readyRead()));
socket.connectToHost(QtNetworkSettings::serverName(), 12346); socket.connectToHost(QtNetworkSettings::serverName(), 12346);

View File

@ -883,7 +883,7 @@ void tst_QUdpSocket::writeDatagram()
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError"); qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
for(int i=0;;i++) { for(int i=0;;i++) {
QSignalSpy errorspy(&client, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy errorspy(&client, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
QSignalSpy bytesspy(&client, SIGNAL(bytesWritten(qint64))); QSignalSpy bytesspy(&client, SIGNAL(bytesWritten(qint64)));
qint64 written = client.writeDatagram(QByteArray(i * 1024, 'w'), serverAddress, qint64 written = client.writeDatagram(QByteArray(i * 1024, 'w'), serverAddress,
@ -1044,7 +1044,7 @@ void tst_QUdpSocket::writeToNonExistingPeer()
QUdpSocket sConnected; QUdpSocket sConnected;
QSignalSpy sConnectedReadyReadSpy(&sConnected, SIGNAL(readyRead())); QSignalSpy sConnectedReadyReadSpy(&sConnected, SIGNAL(readyRead()));
QSignalSpy sConnectedErrorSpy(&sConnected, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy sConnectedErrorSpy(&sConnected, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
sConnected.connectToHost(peerAddress, peerPort, QIODevice::ReadWrite); sConnected.connectToHost(peerAddress, peerPort, QIODevice::ReadWrite);
QVERIFY(sConnected.waitForConnected(10000)); QVERIFY(sConnected.waitForConnected(10000));

View File

@ -410,7 +410,7 @@ private:
static QString certDirPath; static QString certDirPath;
void (QSslSocket::*socketErrorSignal)(QAbstractSocket::SocketError) = &QAbstractSocket::error; void (QSslSocket::*socketErrorSignal)(QAbstractSocket::SocketError) = &QAbstractSocket::errorOccurred;
void (QSslSocket::*tlsErrorsSignal)(const QList<QSslError> &) = &QSslSocket::sslErrors; void (QSslSocket::*tlsErrorsSignal)(const QList<QSslError> &) = &QSslSocket::sslErrors;
void (QTestEventLoop::*exitLoopSlot)() = &QTestEventLoop::exitLoop; void (QTestEventLoop::*exitLoopSlot)() = &QTestEventLoop::exitLoop;

View File

@ -1240,7 +1240,7 @@ protected:
configuration.setProtocol(protocol); configuration.setProtocol(protocol);
if (ignoreSslErrors) if (ignoreSslErrors)
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError))); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError)));
QFile file(m_keyFile); QFile file(m_keyFile);
QVERIFY(file.open(QIODevice::ReadOnly)); QVERIFY(file.open(QIODevice::ReadOnly));
@ -1377,8 +1377,8 @@ void tst_QSslSocket::protocolServerSide()
socket = &client; socket = &client;
QFETCH(QSsl::SslProtocol, clientProtocol); QFETCH(QSsl::SslProtocol, clientProtocol);
socket->setProtocol(clientProtocol); socket->setProtocol(clientProtocol);
// upon SSL wrong version error, error will be triggered, not sslErrors // upon SSL wrong version error, errorOccurred will be triggered, not sslErrors
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -1438,8 +1438,8 @@ void tst_QSslSocket::serverCipherPreferences()
sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")}); sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")});
socket->setSslConfiguration(sslConfig); socket->setSslConfiguration(sslConfig);
// upon SSL wrong version error, error will be triggered, not sslErrors // upon SSL wrong version error, errorOccurred will be triggered, not sslErrors
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -1470,8 +1470,8 @@ void tst_QSslSocket::serverCipherPreferences()
sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")}); sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")});
socket->setSslConfiguration(sslConfig); socket->setSslConfiguration(sslConfig);
// upon SSL wrong version error, error will be triggered, not sslErrors // upon SSL wrong version error, errorOccurred will be triggered, not sslErrors
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -1561,7 +1561,7 @@ void tst_QSslSocket::setLocalCertificateChain()
const QScopedPointer<QSslSocket, QScopedPointerDeleteLater> client(new QSslSocket); const QScopedPointer<QSslSocket, QScopedPointerDeleteLater> client(new QSslSocket);
socket = client.data(); socket = client.data();
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
socket->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort()); socket->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
@ -2551,8 +2551,8 @@ void tst_QSslSocket::closeWhileEmittingSocketError()
clientConfig.setPeerVerifyMode(QSslSocket::VerifyNone); clientConfig.setPeerVerifyMode(QSslSocket::VerifyNone);
clientSocket.setSslConfiguration(clientConfig); clientSocket.setSslConfiguration(clientConfig);
QSignalSpy socketErrorSpy(&clientSocket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy socketErrorSpy(&clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
void (QSslSocket::*errorSignal)(QAbstractSocket::SocketError) = &QSslSocket::error; void (QSslSocket::*errorSignal)(QAbstractSocket::SocketError) = &QSslSocket::errorOccurred;
connect(&clientSocket, errorSignal, &handshake, &BrokenPskHandshake::socketError); connect(&clientSocket, errorSignal, &handshake, &BrokenPskHandshake::socketError);
clientSocket.connectToHostEncrypted(QStringLiteral("127.0.0.1"), handshake.serverPort()); clientSocket.connectToHostEncrypted(QStringLiteral("127.0.0.1"), handshake.serverPort());
@ -2652,7 +2652,7 @@ void tst_QSslSocket::ignoreSslErrorsList()
socket.ignoreSslErrors(expectedSslErrors); socket.ignoreSslErrors(expectedSslErrors);
QFETCH(int, expectedSslErrorSignalCount); QFETCH(int, expectedSslErrorSignalCount);
QSignalSpy sslErrorsSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy sslErrorsSpy(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443); socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443);
@ -2946,13 +2946,13 @@ void tst_QSslSocket::resume()
QSignalSpy sslErrorSpy(&socket, SIGNAL(sslErrors(QList<QSslError>))); QSignalSpy sslErrorSpy(&socket, SIGNAL(sslErrors(QList<QSslError>)));
QSignalSpy encryptedSpy(&socket, SIGNAL(encrypted())); QSignalSpy encryptedSpy(&socket, SIGNAL(encrypted()));
QSignalSpy errorSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy errorSpy(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), &QTestEventLoop::instance(), SLOT(exitLoop())); connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), &QTestEventLoop::instance(), SLOT(exitLoop()));
connect(&socket, SIGNAL(encrypted()), &QTestEventLoop::instance(), SLOT(exitLoop())); connect(&socket, SIGNAL(encrypted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
connect(&socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), connect(&socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop())); connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
socket.connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993); socket.connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993);
QTestEventLoop::instance().enterLoop(10); QTestEventLoop::instance().enterLoop(10);
@ -3263,7 +3263,7 @@ void tst_QSslSocket::dhServer()
QSslSocket client; QSslSocket client;
socket = &client; socket = &client;
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -3297,7 +3297,7 @@ void tst_QSslSocket::dhServerCustomParamsNull()
QSslSocket client; QSslSocket client;
socket = &client; socket = &client;
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -3342,7 +3342,7 @@ void tst_QSslSocket::dhServerCustomParams()
QSslSocket client; QSslSocket client;
socket = &client; socket = &client;
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -3377,7 +3377,7 @@ void tst_QSslSocket::ecdhServer()
QSslSocket client; QSslSocket client;
socket = &client; socket = &client;
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -3569,7 +3569,7 @@ void tst_QSslSocket::readBufferMaxSize()
QSslSocketPtr client(new QSslSocket); QSslSocketPtr client(new QSslSocket);
socket = client.data(); socket = client.data();
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit())); connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot())); connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit())); connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
@ -3830,7 +3830,7 @@ void tst_QSslSocket::simplePskConnect()
QSignalSpy sslErrorsSpy(&socket, SIGNAL(sslErrors(QList<QSslError>))); QSignalSpy sslErrorsSpy(&socket, SIGNAL(sslErrors(QList<QSslError>)));
QVERIFY(sslErrorsSpy.isValid()); QVERIFY(sslErrorsSpy.isValid());
QSignalSpy socketErrorsSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError))); QSignalSpy socketErrorsSpy(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
QVERIFY(socketErrorsSpy.isValid()); QVERIFY(socketErrorsSpy.isValid());
QSignalSpy peerVerifyErrorSpy(&socket, SIGNAL(peerVerifyError(QSslError))); QSignalSpy peerVerifyErrorSpy(&socket, SIGNAL(peerVerifyError(QSslError)));
@ -3844,7 +3844,7 @@ void tst_QSslSocket::simplePskConnect()
connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop())); connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
@ -4112,7 +4112,7 @@ void tst_QSslSocket::pskServer()
connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop())); connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop()));
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop())); connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
@ -4292,7 +4292,7 @@ void tst_QSslSocket::signatureAlgorithm()
QEventLoop loop; QEventLoop loop;
QTimer::singleShot(5000, &loop, &QEventLoop::quit); QTimer::singleShot(5000, &loop, &QEventLoop::quit);
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), &loop, &QEventLoop::quit); connect(socket, &QAbstractSocket::errorOccurred, &loop, &QEventLoop::quit);
connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors), this, &tst_QSslSocket::ignoreErrorSlot); connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors), this, &tst_QSslSocket::ignoreErrorSlot);
connect(socket, &QSslSocket::encrypted, &loop, &QEventLoop::quit); connect(socket, &QSslSocket::encrypted, &loop, &QEventLoop::quit);

View File

@ -53,7 +53,7 @@ DataTransfererQTcp::DataTransfererQTcp(QObject* parent)
connect(&m_qsocket, SIGNAL(readyRead()), this, SLOT(readyRead())); connect(&m_qsocket, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(&m_qsocket, SIGNAL(connected()), this, SLOT(connected())); connect(&m_qsocket, SIGNAL(connected()), this, SLOT(connected()));
connect(&m_qsocket, SIGNAL(error(QAbstractSocket::SocketError)), connect(&m_qsocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(error(QAbstractSocket::SocketError))); this, SLOT(error(QAbstractSocket::SocketError)));
} }