diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-09-22 00:33:17 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-09-25 00:58:41 +0000 |
commit | b0561e6382ccc880d9e3dab78d967478eca611bb (patch) | |
tree | 9122844de8fd8deeda980fd9b15f4d7c6e70ec62 /src/corelib/global/qoperatingsystemversion.h | |
parent | 0d0ad598c54652dbe04d5716025facd83adc979b (diff) |
Add currentType function to QOperatingSystemVersion
This allows us to retrieve the current OS type without constructing an
instance of the class, and it's also constexpr.
Change-Id: I8b32a1aebeb8139fe3fcf146e5de558fa1060bb8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qoperatingsystemversion.h')
-rw-r--r-- | src/corelib/global/qoperatingsystemversion.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h index 55030c2200..5f27deab9e 100644 --- a/src/corelib/global/qoperatingsystemversion.h +++ b/src/corelib/global/qoperatingsystemversion.h @@ -92,6 +92,25 @@ public: static QOperatingSystemVersion current(); + static Q_DECL_CONSTEXPR OSType currentType() + { +#if defined(Q_OS_WIN) + return Windows; +#elif defined(Q_OS_MACOS) + return MacOS; +#elif defined(Q_OS_IOS) + return IOS; +#elif defined(Q_OS_TVOS) + return TvOS; +#elif defined(Q_OS_WATCHOS) + return WatchOS; +#elif defined(Q_OS_ANDROID) + return Android; +#else + return Unknown; +#endif + } + Q_DECL_CONSTEXPR int majorVersion() const { return m_major; } Q_DECL_CONSTEXPR int minorVersion() const { return m_minor; } Q_DECL_CONSTEXPR int microVersion() const { return m_micro; } |