@@ -413,8 +413,14 @@ void DiagnosticsDialog::VerifyClock(unsigned int connections)
413413 m_udpSocket = new QUdpSocket (this );
414414
415415 connect (m_udpSocket, &QUdpSocket::stateChanged, this , &DiagnosticsDialog::clkStateChanged);
416+
417+ // For Qt 5.15 and above QAbstractSocket::error has been deprecated in favor of errorOccurred.
418+ #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
416419 connect (m_udpSocket, static_cast <QAbstractSocket::SocketError (QUdpSocket::*)() const >(&QUdpSocket::error),
417420 this , static_cast <void (DiagnosticsDialog::*)()>(&DiagnosticsDialog::clkSocketError));
421+ #else
422+ connect (m_udpSocket, &QUdpSocket::errorOccurred, this , &DiagnosticsDialog::clkSocketError);
423+ #endif
418424
419425 if (!NTPHost.addresses ().empty ())
420426 {
@@ -539,8 +545,15 @@ void DiagnosticsDialog::VerifyTCPPort()
539545 m_tcpSocket = new QTcpSocket (this );
540546
541547 connect (m_tcpSocket, &QTcpSocket::connected, this , &DiagnosticsDialog::TCPFinished);
548+
549+ // For Qt 5.15 and above QAbstractSocket::error has been deprecated in favor of errorOccurred.
550+ #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
542551 connect (m_tcpSocket, static_cast <void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QTcpSocket::error),
543552 this , static_cast <void (DiagnosticsDialog::*)(QAbstractSocket::SocketError)>(&DiagnosticsDialog::TCPFailed));
553+ #else
554+ connect (m_tcpSocket, static_cast <void (QTcpSocket::*)(QAbstractSocket::SocketError)>(&QTcpSocket::errorOccurred),
555+ this , static_cast <void (DiagnosticsDialog::*)(QAbstractSocket::SocketError)>(&DiagnosticsDialog::TCPFailed));
556+ #endif
544557
545558 m_tcpSocket->connectToHost (" portquiz.net" , GetListenPort ());
546559}
0 commit comments