Skip to content

Commit da4162a

Browse files
committed
Add Qt version check for errorOccurred()
1 parent 031ce5c commit da4162a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/client.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,17 @@ 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+
#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) // earlier versions don't work
269270
connect ( pSocket, &QTcpSocket::errorOccurred, this, [this, pSocket] ( QAbstractSocket::SocketError err ) {
270271
Q_UNUSED ( err );
271272

272273
qWarning() << "- TCP connection error:" << pSocket->errorString();
273274
// may want to specifically handle ConnectionRefusedError?
274275
pSocket->deleteLater();
275276
} );
277+
#else
278+
# warning "QTcpSocket::errorOccurred requires Qt >= 5.15.0"
279+
#endif
276280

277281
connect ( pSocket, &QTcpSocket::connected, this, [this, pSocket, InetAddr, vecMessage]() {
278282
// connection succeeded, give it to a CTcpConnection

0 commit comments

Comments
 (0)