diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 19 | ||||
-rw-r--r-- | src/corelib/global/qsysinfo.h | 19 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index d56854064d..2d4edb48d1 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -985,9 +985,9 @@ bool qSharedBuild() Q_DECL_NOTHROW \li \l ByteOrder specifies whether the platform is big-endian or little-endian. \li \l WindowsVersion specifies the version of the Windows operating - system on which the application is run (Windows only) + system on which the application is run. \li \l MacintoshVersion specifies the version of the Macintosh - operating system on which the application is run (Mac only). + operating system on which the application is run. \endlist Some constants are defined only on certain platforms. You can use @@ -1010,7 +1010,7 @@ bool qSharedBuild() Q_DECL_NOTHROW /*! \variable QSysInfo::WindowsVersion \brief the version of the Windows operating system on which the - application is run (Windows only) + application is run. */ /*! @@ -1018,19 +1018,22 @@ bool qSharedBuild() Q_DECL_NOTHROW \since 4.4 Returns the version of the Windows operating system on which the - application is run (Windows only). + application is run, or WV_None if the operating system is not + Windows. */ /*! \variable QSysInfo::MacintoshVersion \brief the version of the Macintosh operating system on which - the application is run (Mac only). + the application is run. */ /*! \fn QSysInfo::MacVersion QSysInfo::macVersion() - Returns the version of Darwin (OS X or iOS) on which the application is run. + Returns the version of Darwin (OS X or iOS) on which the + application is run, or MV_None if the operating system + is not a version of Darwin. */ /*! @@ -1093,6 +1096,8 @@ bool qSharedBuild() Q_DECL_NOTHROW \value WV_NT_based NT-based version of Windows \value WV_CE_based CE-based version of Windows + \value WV_None Operating system other than Windows. + \sa MacVersion */ @@ -1140,6 +1145,8 @@ bool qSharedBuild() Q_DECL_NOTHROW \value MV_IOS_7_1 iOS 7.1 \value MV_IOS_8_0 iOS 8.0 + \value MV_None Not a Darwin operating system + \sa WinVersion */ diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index 2ac18f2ed8..35672479e0 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -72,8 +72,9 @@ public: # endif }; #endif -#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) enum WinVersion { + WV_None = 0x0000, + WV_32s = 0x0001, WV_95 = 0x0002, WV_98 = 0x0003, @@ -107,14 +108,18 @@ public: WV_CE_6 = 0x0400, WV_CE_based = 0x0f00 }; +#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) static const WinVersion WindowsVersion; static WinVersion windowsVersion(); - +#else + static const WinVersion WindowsVersion = WV_None; + static WinVersion windowsVersion() { return WV_None; } #endif -#ifdef Q_OS_MAC -# define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0)) -# define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor) + +#define Q_MV_OSX(major, minor) (major == 10 ? minor + 2 : (major == 9 ? 1 : 0)) +#define Q_MV_IOS(major, minor) (QSysInfo::MV_IOS | major << 4 | minor) enum MacVersion { + MV_None = 0xffff, MV_Unknown = 0x0000, /* version */ @@ -155,8 +160,12 @@ public: MV_IOS_7_1 = Q_MV_IOS(7, 1), MV_IOS_8_0 = Q_MV_IOS(8, 0) }; +#if defined(Q_OS_MAC) static const MacVersion MacintoshVersion; static MacVersion macVersion(); +#else + static const MacVersion MacintoshVersion = MV_None; + static MacVersion macVersion() { return MV_None; } #endif static QString buildCpuArchitecture(); |