Skip to content

Commit d939e5b

Browse files
committed
Add Qt version check for errorOccurred()
1 parent 3a12b7c commit d939e5b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/client.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,12 @@ void CClient::OnSendCLProtMessage ( CHostAddress InetAddr, CVector<uint8_t> vecM
266266
// create a TCP client connection and send message
267267
QTcpSocket* pSocket = new QTcpSocket ( this );
268268

269-
connect ( pSocket, &QTcpSocket::errorOccurred, this, [this, pSocket] ( QAbstractSocket::SocketError err ) {
269+
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 )
270+
# define ERRORSIGNAL &QTcpSocket::errorOccurred
271+
#else
272+
# define ERRORSIGNAL QOverload<QAbstractSocket::SocketError>::of ( &QAbstractSocket::error )
273+
#endif
274+
connect ( pSocket, ERRORSIGNAL, this, [this, pSocket] ( QAbstractSocket::SocketError err ) {
270275
Q_UNUSED ( err );
271276

272277
qWarning() << "- TCP connection error:" << pSocket->errorString();

0 commit comments

Comments
 (0)