aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Klitzing <aklitzing@gmail.com>2017-10-11 15:54:57 +0200
committerAndré Klitzing <aklitzing@gmail.com>2017-10-30 11:12:52 +0000
commitf7c5b8fce9517b3062eeab0ec7e8e46867d1f977 (patch)
treea26e6211e0e2586703ec5f5f3b360a69153cc79a
parent2d69b22c5ca6f1a163988909ac0742b9597ca73b (diff)
Replace typedefs by QOverload
Change-Id: I509332fa23bcf2cf2e6c10b7edacb4157f025ff9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--examples/websockets/sslechoclient/sslechoclient.cpp3
-rw-r--r--src/websockets/qsslserver.cpp9
-rw-r--r--src/websockets/qwebsocket_p.cpp9
-rw-r--r--tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp3
4 files changed, 10 insertions, 14 deletions
diff --git a/examples/websockets/sslechoclient/sslechoclient.cpp b/examples/websockets/sslechoclient/sslechoclient.cpp
index 3de2fec..6427f88 100644
--- a/examples/websockets/sslechoclient/sslechoclient.cpp
+++ b/examples/websockets/sslechoclient/sslechoclient.cpp
@@ -59,8 +59,7 @@ SslEchoClient::SslEchoClient(const QUrl &url, QObject *parent) :
QObject(parent)
{
connect(&m_webSocket, &QWebSocket::connected, this, &SslEchoClient::onConnected);
- typedef void (QWebSocket:: *sslErrorsSignal)(const QList<QSslError> &);
- connect(&m_webSocket, static_cast<sslErrorsSignal>(&QWebSocket::sslErrors),
+ connect(&m_webSocket, QOverload<const QList<QSslError>&>::of(&QWebSocket::sslErrors),
this, &SslEchoClient::onSslErrors);
m_webSocket.open(QUrl(url));
}
diff --git a/src/websockets/qsslserver.cpp b/src/websockets/qsslserver.cpp
index 5df59f7..586e520 100644
--- a/src/websockets/qsslserver.cpp
+++ b/src/websockets/qsslserver.cpp
@@ -115,11 +115,12 @@ void QSslServer::incomingConnection(qintptr socket)
if (Q_LIKELY(pSslSocket->setSocketDescriptor(socket))) {
connect(pSslSocket, &QSslSocket::peerVerifyError, this, &QSslServer::peerVerifyError);
- typedef void (QSslSocket::* sslErrorsSignal)(const QList<QSslError> &);
- connect(pSslSocket, static_cast<sslErrorsSignal>(&QSslSocket::sslErrors),
+ connect(pSslSocket, QOverload<const QList<QSslError>&>::of(&QSslSocket::sslErrors),
this, &QSslServer::sslErrors);
- connect(pSslSocket, &QSslSocket::encrypted, this, &QSslServer::newEncryptedConnection);
- connect(pSslSocket, &QSslSocket::preSharedKeyAuthenticationRequired, this, &QSslServer::preSharedKeyAuthenticationRequired);
+ connect(pSslSocket, &QSslSocket::encrypted,
+ this, &QSslServer::newEncryptedConnection);
+ connect(pSslSocket, &QSslSocket::preSharedKeyAuthenticationRequired,
+ this, &QSslServer::preSharedKeyAuthenticationRequired);
addPendingConnection(pSslSocket);
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 5e1a103..1a1bb1f 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -563,11 +563,9 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
if (Q_LIKELY(pTcpSocket)) {
//pass through signals
- typedef void (QAbstractSocket:: *ASErrorSignal)(QAbstractSocket::SocketError);
- typedef void (QWebSocket:: *WSErrorSignal)(QAbstractSocket::SocketError);
QObject::connect(pTcpSocket,
- static_cast<ASErrorSignal>(&QAbstractSocket::error),
- q, static_cast<WSErrorSignal>(&QWebSocket::error));
+ QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
+ q, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error));
#ifndef QT_NO_NETWORKPROXY
QObject::connect(pTcpSocket, &QAbstractSocket::proxyAuthenticationRequired, q,
&QWebSocket::proxyAuthenticationRequired);
@@ -595,9 +593,8 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
&QWebSocket::preSharedKeyAuthenticationRequired);
QObject::connect(sslSocket, &QSslSocket::encryptedBytesWritten, q,
&QWebSocket::bytesWritten);
- typedef void (QSslSocket:: *sslErrorSignalType)(const QList<QSslError> &);
QObject::connect(sslSocket,
- static_cast<sslErrorSignalType>(&QSslSocket::sslErrors),
+ QOverload<const QList<QSslError>&>::of(&QSslSocket::sslErrors),
q, &QWebSocket::sslErrors);
QObjectPrivate::connect(sslSocket, &QSslSocket::encrypted,
this, &QWebSocketPrivate::_q_updateSslConfiguration);
diff --git a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp
index 8f3e293..45394bc 100644
--- a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp
+++ b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp
@@ -606,9 +606,8 @@ void tst_QWebSocketServer::tst_scheme()
QVERIFY(secureServer.listen());
QWebSocket secureSocket;
- typedef void (QWebSocket::* ignoreSslErrorsSlot)();
connect(&secureSocket, &QWebSocket::sslErrors,
- &secureSocket, static_cast<ignoreSslErrorsSlot>(&QWebSocket::ignoreSslErrors));
+ &secureSocket, QOverload<>::of(&QWebSocket::ignoreSslErrors));
secureSocket.open(secureServer.serverUrl().toString());
if (secureServerConnectionSpy.count() == 0)