diff --git a/src/network/compat/removed_api.cpp b/src/network/compat/removed_api.cpp index ceda1175385..f24cb308bd3 100644 --- a/src/network/compat/removed_api.cpp +++ b/src/network/compat/removed_api.cpp @@ -63,6 +63,17 @@ QList QNetworkCookie::parseCookies(const QByteArray &cookieStrin #endif #include "qnetworkrequest.h" // inlined API +#include "qsslerror.h" + +#ifndef QT_NO_DEBUG_STREAM +#if QT_CONFIG(ssl) +QDebug operator<<(QDebug debug, const QSslError::SslError &error) +{ + return print(std::move(debug), error); +} +#endif +#endif + // #include "qotherheader.h" // // implement removed functions from qotherheader.h // order sections alphabetically diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 97faa8993c9..94666fd25d7 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -348,7 +348,8 @@ QDebug operator<<(QDebug debug, const QSslError &error) debug << error.errorString(); return debug; } -QDebug operator<<(QDebug debug, const QSslError::SslError &error) + +QDebug print(QDebug debug, QSslError::SslError error) { debug << QSslError(error).errorString(); return debug; diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h index d82b086d392..1f461bf26d7 100644 --- a/src/network/ssl/qsslerror.h +++ b/src/network/ssl/qsslerror.h @@ -16,6 +16,10 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_SSL +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +#endif + class QSslErrorPrivate; class Q_NETWORK_EXPORT QSslError { @@ -88,16 +92,23 @@ public: private: // ### Qt 7: make QSslError implicitly shared std::unique_ptr d; +#ifndef QT_NO_DEBUG_STREAM + Q_NETWORK_EXPORT friend QDebug print(QDebug debug, QSslError::SslError error); + friend QDebug operator<<(QDebug debug, SslError error) + { return print(std::move(debug), error); } +#endif }; Q_DECLARE_SHARED(QSslError) Q_NETWORK_EXPORT size_t qHash(const QSslError &key, size_t seed = 0) noexcept; #ifndef QT_NO_DEBUG_STREAM -class QDebug; + Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError &error); +#if QT_NETWORK_REMOVED_SINCE(6, 8) Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QSslError::SslError &error); #endif +#endif #else class Q_NETWORK_EXPORT QSslError {}; // dummy class so that moc has a complete type #endif // QT_NO_SSL