From 34aa7a18af5d355380c662bb1a10b3f0d7b7ed3e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 18 Sep 2017 13:01:02 +0200 Subject: [PATCH] QOperatingSystemVersion: Add debug operator Change-Id: Ibc942196bef0edc74f34501830fc83cb64259e39 Reviewed-by: Thiago Macieira Reviewed-by: Jake Petroules --- src/corelib/global/qoperatingsystemversion.cpp | 13 +++++++++++++ src/corelib/global/qoperatingsystemversion.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 594dc6bc17..a77727320b 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -43,6 +43,7 @@ #endif #include +#include #if defined(Q_OS_ANDROID) #include @@ -510,4 +511,16 @@ const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 = const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo = QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0); +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov) +{ + QDebugStateSaver saver(debug); + debug.nospace(); + debug << "QOperatingSystemVersion(" << ov.name() + << ", " << ov.majorVersion() << '.' << ov.minorVersion() + << '.' << ov.microVersion() << ')'; + return debug; +} +#endif // !QT_NO_DEBUG_STREAM + QT_END_NAMESPACE diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 1f3ff8e1ab..55030c2200 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -128,6 +128,11 @@ private: }; Q_DECLARE_TYPEINFO(QOperatingSystemVersion, QT_VERSION < QT_VERSION_CHECK(6, 0, 0) ? Q_RELOCATABLE_TYPE : Q_PRIMITIVE_TYPE); +#ifndef QT_NO_DEBUG_STREAM +class QDebug; +Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QOperatingSystemVersion &ov); +#endif + QT_END_NAMESPACE #endif // QOPERATINGSYSTEMVERSION_H