From 2ccb905ad433917242df8cde46a6a87feb064688 Mon Sep 17 00:00:00 2001 From: Viktor Kopp Date: Sun, 28 Jul 2024 09:30:50 +0200 Subject: [PATCH] fix signal for socket error The QAbstractSocket::error signal existed in Qt<5.15, but was renamed to QAbstractSocket::errorOccured probably to avoid https://stackoverflow.com/a/48250710 Since the codebase still uses the old style of connections the compiler could not detect that signal does not exist anymore and error was reported only on runtime: "qt.core.qobject.connect: QObject::connect: No such signal QTcpSocket::error(QAbstractSocket::SocketError)" Signed-off-by: Viktor Kopp --- src/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f00ab1c7..5c04edd7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3532,7 +3532,7 @@ void MainWindow::connectECU(EcuItem* ecuitem,bool force) disconnect(ecuitem->socket,0,0,0); connect(ecuitem->socket,SIGNAL(connected()),this,SLOT(connected())); connect(ecuitem->socket,SIGNAL(disconnected()),this,SLOT(disconnected())); - connect(ecuitem->socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError))); + connect(ecuitem->socket, &QAbstractSocket::errorOccurred, this, &MainWindow::error); connect(ecuitem->socket,SIGNAL(readyRead()),this,SLOT(readyRead())); connect(ecuitem->socket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(stateChangedIP(QAbstractSocket::SocketState))); ecuitem->socket->connectToHost(ecuitem->getHostname(),ecuitem->getIpport()); @@ -3615,7 +3615,7 @@ void MainWindow::connectECU(EcuItem* ecuitem,bool force) connect(ecuitem->socket,SIGNAL(connected()),this,SLOT(connected())); connect(ecuitem->socket,SIGNAL(disconnected()),this,SLOT(disconnected())); - connect(ecuitem->socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError))); + connect(ecuitem->socket,&QAbstractSocket::errorOccurred, this, &MainWindow::error); connect(ecuitem->socket,SIGNAL(readyRead()),this,SLOT(readyRead())); connect(ecuitem->socket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(stateChangedIP(QAbstractSocket::SocketState))); ecuitem->update();