Skip to content

Commit

Permalink
fix signal for socket error
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)"
  • Loading branch information
vifactor committed Aug 31, 2024
1 parent b78fa89 commit 82190ea
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 82190ea

Please sign in to comment.