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 17:42:51 +0200
commit34d94242e9a81e28989486dd232880dcd830217c (patch)
treefac4cfdecafca7e42a3cbac4cb93aa06c440ff70 /src/corelib/global
parent45d340851d5f88fb27fb7be011079fa1ae238a3f (diff)
Add QOperatingSystemVersion support for macOS Big Sur
Change-Id: Ide57f675b20b08210f301da5177df45d008423c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 19d32f0a5fc8b12e03a84ab6e18845337fd3b70f) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@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 261f5c8795..9768690bdd 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>
@@ -446,6 +450,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 f22878de89..4aeefef0e0 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 ab023a6cb5..ad5d30d544 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -249,6 +249,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
@@ -264,6 +267,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