From 48a5d94fd66358be3ebe265fbf152d54364469e0 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sun, 25 Sep 2022 11:42:57 +0800 Subject: OpenGL: add support for Win11 detection The current code can't distinguish between Windows 10 and Windows 11, this patch fixes that. Change-Id: I8269f0544c09205ae9845b7981f4a86c664bee09 Reviewed-by: Volker Hilsheimer --- src/gui/opengl/qopengl.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index edb359f686..7c997103d5 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -195,20 +195,13 @@ struct OsTypeTerm static QString hostOs(); static QVersionNumber hostKernelVersion() { return QVersionNumber::fromString(QSysInfo::kernelVersion()); } static QString hostOsRelease() { - QString ver; #ifdef Q_OS_WIN - const auto osver = QOperatingSystemVersion::current(); -#define Q_WINVER(major, minor) (major << 8 | minor) - switch (Q_WINVER(osver.majorVersion(), osver.minorVersion())) { - case Q_WINVER(10, 0): - ver = QStringLiteral("10"); - break; - default: - break; - } -#undef Q_WINVER + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11) + return u"11"_s; + return u"10"_s; +#else + return {}; #endif - return ver; } bool isNull() const { return type.isEmpty(); } -- cgit v1.2.3