From 9c1d7007f35d45b8e0351bff03377284b5f07dfc Mon Sep 17 00:00:00 2001 From: "James C. Owens" Date: Wed, 18 Aug 2021 18:35:37 -0400 Subject: [PATCH] Use macro conditional to change to errorOccurred from error Qt 5.15 and above has deprecated QAbstractSocket::error in favor of QAbstractSocket::errorOccurred --- src/qt/diagnosticsdialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/qt/diagnosticsdialog.cpp b/src/qt/diagnosticsdialog.cpp index 1004f257b2..d36d8f15bc 100644 --- a/src/qt/diagnosticsdialog.cpp +++ b/src/qt/diagnosticsdialog.cpp @@ -413,8 +413,14 @@ void DiagnosticsDialog::VerifyClock(unsigned int connections) m_udpSocket = new QUdpSocket(this); connect(m_udpSocket, &QUdpSocket::stateChanged, this, &DiagnosticsDialog::clkStateChanged); + + // For Qt 5.15 and above QAbstractSocket::error has been deprecated in favor of errorOccurred. +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) connect(m_udpSocket, static_cast(&QUdpSocket::error), this, static_cast(&DiagnosticsDialog::clkSocketError)); +#else + connect(m_udpSocket, &QUdpSocket::errorOccurred, this, &DiagnosticsDialog::clkSocketError); +#endif if (!NTPHost.addresses().empty()) { @@ -539,8 +545,15 @@ void DiagnosticsDialog::VerifyTCPPort() m_tcpSocket = new QTcpSocket(this); connect(m_tcpSocket, &QTcpSocket::connected, this, &DiagnosticsDialog::TCPFinished); + + // For Qt 5.15 and above QAbstractSocket::error has been deprecated in favor of errorOccurred. +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) connect(m_tcpSocket, static_cast(&QTcpSocket::error), this, static_cast(&DiagnosticsDialog::TCPFailed)); +#else + connect(m_tcpSocket, static_cast(&QTcpSocket::errorOccurred), + this, static_cast(&DiagnosticsDialog::TCPFailed)); +#endif m_tcpSocket->connectToHost("portquiz.net", GetListenPort()); }