From 870cfa4e17c42698b77504cfc19728acfbf7d659 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Tue, 24 May 2022 14:05:10 +0800 Subject: [PATCH] QSysInfo::prettyProductName(): add missing macOS product names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pick-to: 6.2 6.3 6.4 5.15 Change-Id: I9163917187b7a4cbf48e443303313b25473b229f Reviewed-by: Thiago Macieira Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qglobal.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f8db9e948e..25dcbbb97e 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1993,6 +1993,11 @@ QT_END_INCLUDE_NAMESPACE static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSystemVersion::current()) { #ifdef Q_OS_MACOS + if (version.majorVersion() == 12) + return "Monterey"; + // Compare against predefined constant to handle 10.16/11.0 + if (QOperatingSystemVersion::MacOSBigSur.version().isPrefixOf(version.version())) + return "Big Sur"; if (version.majorVersion() == 10) { switch (version.minorVersion()) { case 9: @@ -2007,13 +2012,15 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst return "High Sierra"; case 14: return "Mojave"; + case 15: + return "Catalina"; } } // unknown, future version #else Q_UNUSED(version); #endif - return 0; + return nullptr; } #endif @@ -2107,7 +2114,7 @@ static const char *osVer_helper(QOperatingSystemVersion version = QOperatingSyst } #undef Q_WINVER // unknown, future version - return 0; + return nullptr; } #endif