summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-07-28 16:45:07 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-07-29 13:25:28 +0200
commit19d32f0a5fc8b12e03a84ab6e18845337fd3b70f (patch)
treec0f3e33e8d5fc1d1f9d32b2b5f580b120ede1ba1 /src/corelib/global
parent3e71e2e85124b750c0e385212d44ea57acf270f3 (diff)
Add QOperatingSystemVersion support for macOS Big Sur
Pick-to: 5.15 Pick-to: 5.12 Change-Id: Ide57f675b20b08210f301da5177df45d008423c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qoperatingsystemversion.cpp25
-rw-r--r--src/corelib/global/qoperatingsystemversion.h1
-rw-r--r--src/corelib/global/qsystemdetection.h6
3 files changed, 32 insertions, 0 deletions
diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp
index cbd9f85264..1d7ec46c11 100644
--- a/src/corelib/global/qoperatingsystemversion.cpp
+++ b/src/corelib/global/qoperatingsystemversion.cpp
@@ -42,6 +42,10 @@
#include "qoperatingsystemversion_p.h"
#endif
+#if defined(Q_OS_DARWIN)
+#include <QtCore/private/qcore_mac_p.h>
+#endif
+
#include <qversionnumber.h>
#include <qdebug.h>
@@ -442,6 +446,27 @@ const QOperatingSystemVersion QOperatingSystemVersion::MacOSCatalina =
QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 15);
/*!
+ \variable QOperatingSystemVersion::MacOSBigSur
+ \brief a version corresponding to macOS Big Sur
+
+ The actual version number depends on whether the application was built
+ using the Xcode 12 SDK. If it was, the version number corresponds
+ to macOS 11.0. If not it will correspond to macOS 10.16.
+
+ By comparing QOperatingSystemVersion::current() to this constant
+ you will always end up comparing to the right version number.
+ \since 6.0
+ */
+const QOperatingSystemVersion QOperatingSystemVersion::MacOSBigSur = [] {
+#if defined(Q_OS_DARWIN)
+ if (QMacVersion::buildSDK(QMacVersion::ApplicationBinary) >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 16))
+ return QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 11, 0);
+ else
+#endif
+ return QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 16);
+}();
+
+/*!
\variable QOperatingSystemVersion::AndroidJellyBean
\brief a version corresponding to Android Jelly Bean (version 4.1, API level 16).
\since 5.9
diff --git a/src/corelib/global/qoperatingsystemversion.h b/src/corelib/global/qoperatingsystemversion.h
index 60243dd898..1a8d38400b 100644
--- a/src/corelib/global/qoperatingsystemversion.h
+++ b/src/corelib/global/qoperatingsystemversion.h
@@ -72,6 +72,7 @@ public:
static const QOperatingSystemVersion MacOSHighSierra;
static const QOperatingSystemVersion MacOSMojave;
static const QOperatingSystemVersion MacOSCatalina;
+ static const QOperatingSystemVersion MacOSBigSur;
static const QOperatingSystemVersion AndroidJellyBean;
static const QOperatingSystemVersion AndroidJellyBean_MR1;
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 11b3d8fbf0..c8f98042c9 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -233,6 +233,9 @@
# if !defined(__MAC_10_15)
# define __MAC_10_15 101500
# endif
+# if !defined(__MAC_10_16)
+# define __MAC_10_16 101600
+# endif
# if !defined(MAC_OS_X_VERSION_10_11)
# define MAC_OS_X_VERSION_10_11 __MAC_10_11
# endif
@@ -248,6 +251,9 @@
# if !defined(MAC_OS_X_VERSION_10_15)
# define MAC_OS_X_VERSION_10_15 __MAC_10_15
# endif
+# if !defined(MAC_OS_X_VERSION_10_16)
+# define MAC_OS_X_VERSION_10_16 __MAC_10_16
+# endif
#
# if !defined(__IPHONE_10_0)
# define __IPHONE_10_0 100000