From dc20cf6449b060b3230335827a53cd64453eaf72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Fri, 5 Jun 2020 12:36:34 -0300 Subject: [PATCH] TCPLink: Add new errorOccurred for Qt 5.15 builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/comm/TCPLink.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc index 66c6e04b5b..1bd578ed8f 100644 --- a/src/comm/TCPLink.cc +++ b/src/comm/TCPLink.cc @@ -150,12 +150,21 @@ bool TCPLink::_hardwareConnect() Q_ASSERT(_socket == nullptr); _socket = new QTcpSocket(); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QSignalSpy errorSpy(_socket, static_cast(&QTcpSocket::error)); +#else + QSignalSpy errorSpy(_socket, &QAbstractSocket::errorOccurred); +#endif + _socket->connectToHost(_tcpConfig->address(), _tcpConfig->port()); QObject::connect(_socket, &QTcpSocket::readyRead, this, &TCPLink::readBytes); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) QObject::connect(_socket,static_cast(&QTcpSocket::error), this, &TCPLink::_socketError); +#else + QObject::connect(_socket, &QAbstractSocket::errorOccurred, this, &TCPLink::_socketError); +#endif // Give the socket a second to connect to the other side otherwise error out if (!_socket->waitForConnected(1000)) -- GitLab