SIGNAL/SLOT migration: socket_handler (5), targettimer (1), socketreader (2) + status update
- Migrated old SIGNAL/SLOT connect syntax to function-pointer syntax - socket_handler.cpp: timeout, connected, disconnected, readyRead, bytesWritten - targettimer.cpp: timeout → MyTimerSlot - socketreader.cpp: readyRead, error (with QOverload for overloaded signal) - Updated MIGRATION_STATUS.md with migration progress - Part of Qt5→Qt6 migration with C++17 constraint (RTI 7.7.0 compatibility)
This commit is contained in:
1 parent
bf0b1a3ddd
commit
060792032b
4 files changed
+22
-14
No files matched your search
+3
-2
@@ -24,8 +24,9 @@ bool SocketReader::init(const QString &host, quint16 port, int hlaRequestIdentif
|
||||
DEBUG_LOG(m_logger) << "SR " << hlaRequestIdentifier << ": Trying to establish connection to " << host << ":" << port;
|
||||
|
||||
m_hlaRequestIdentifier = hlaRequestIdentifier;
|
||||
connect(m_socket, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
|
||||
connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(onSocketError(QAbstractSocket::SocketError)));
|
||||
connect(m_socket, &QTcpSocket::readyRead, this, &SocketReader::onReadyRead);
|
||||
connect(m_socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error),
|
||||
this, &SocketReader::onSocketError);
|
||||
|
||||
m_socket->connectToHost(host, port, QIODevice::ReadOnly);
|
||||
return m_socket->waitForConnected(1000);
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ TargetTimer::TargetTimer(int participantId,
|
||||
m_preWarningInterval = preWarningInterval;
|
||||
m_timeToEffectInterval = timeToEffectInterval;
|
||||
timer = new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()),
|
||||
this, SLOT(MyTimerSlot()));
|
||||
connect(timer, &QTimer::timeout,
|
||||
this, &TargetTimer::MyTimerSlot);
|
||||
|
||||
// msec
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ SocketHandler::SocketHandler(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
m_reconnectTimer = new QTimer(this);
|
||||
|
||||
// setup signal and slot
|
||||
connect(m_reconnectTimer, SIGNAL(timeout()),
|
||||
this, SLOT(reconnectTimerSlot()));
|
||||
connect(m_reconnectTimer, &QTimer::timeout,
|
||||
this, &SocketHandler::reconnectTimerSlot);
|
||||
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ void SocketHandler::init(QString nmeaHost, int nmeaPort)
|
||||
m_nmeaHost = nmeaHost;
|
||||
m_nmeaPort = nmeaPort;
|
||||
socket = new QUdpSocket(this);
|
||||
connect(socket, SIGNAL(connected()), this, SLOT(connected()));
|
||||
connect(socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
|
||||
connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
|
||||
connect(socket, &QUdpSocket::connected, this, &SocketHandler::connected);
|
||||
connect(socket, &QUdpSocket::disconnected, this, &SocketHandler::disconnected);
|
||||
connect(socket, &QUdpSocket::readyRead, this, &SocketHandler::readyRead);
|
||||
|
||||
connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));
|
||||
connect(socket, &QUdpSocket::bytesWritten, this, &SocketHandler::bytesWritten);
|
||||
|
||||
INFO_LOG(m_logger) << "Connecting,..";
|
||||
INFO_LOG(m_logger) << nmeaHost << " port: " << nmeaPort;
|
||||
|
||||
Reference in new issue
Block a user