macOS: Optimize detection of dark mode
Change-Id: I579527c54f8453c1e4f57bab7eebfc576b6ad365 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>bb10
parent
8c2ca29045
commit
1075f10184
|
|
@ -170,8 +170,11 @@ QDebug operator<<(QDebug debug, const QMacAutoReleasePool *pool)
|
|||
bool qt_mac_applicationIsInDarkMode()
|
||||
{
|
||||
#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
|
||||
if (__builtin_available(macOS 10.14, *))
|
||||
return [NSApp.effectiveAppearance.name hasSuffix:@"DarkAqua"];
|
||||
if (__builtin_available(macOS 10.14, *)) {
|
||||
auto appearance = [NSApp.effectiveAppearance bestMatchFromAppearancesWithNames:
|
||||
@[ NSAppearanceNameAqua, NSAppearanceNameDarkAqua ]];
|
||||
return [appearance isEqualToString:NSAppearanceNameDarkAqua];
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue