diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-18 13:01:02 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-20 12:19:56 +0000 |
commit | 34aa7a18af5d355380c662bb1a10b3f0d7b7ed3e (patch) | |
tree | e5bacb95d1494fa37ac2ab4a68dfd744747cb9c2 | |
parent | 29b38bea45712c85a0c9f07bfa26524f3a35668f (diff) |
QOperatingSystemVersion: Add debug operator
Change-Id: Ibc942196bef0edc74f34501830fc83cb64259e39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.cpp | 13 | ||||
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.h | 5 |
2 files changed, 18 insertions, 0 deletions
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 <qversionnumber.h> +#include <qdebug.h> #if defined(Q_OS_ANDROID) #include <private/qjni_p.h> @@ -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 |