Skip to content

Commit

Permalink
fix signal for socket error (#519)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
vifactor authored Sep 10, 2024
1 parent c1a6854 commit 0ba5dcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0ba5dcd

Please sign in to comment.