Switch to classic if theme set to auto and high contast mode is on.

The light and dark theme don't respond to Windows's high contrast
accessibility mode, so when the theme is set to "auto", we
default to "classic" instead of "light".

Fixes #5044
This commit is contained in:
Janek Bevendorff authored and Jonathan White committed 2020-08-01 09:01:12 -04:00
1 parent 0070d5f295
commit a32147182a
3 files changed
+12

No files matched your search

+5
View File
@@ -147,6 +147,11 @@ void Application::applyTheme()
auto appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
if (appTheme == "auto") {
appTheme = osUtils->isDarkMode() ? "dark" : "light";
#ifdef Q_OS_WIN
if (winUtils()->isHighContrastMode()) {
appTheme = "classic";
}
#endif
}
if (appTheme == "light") {
+6
View File
@@ -105,3 +105,9 @@ bool WinUtils::isCapslockEnabled()
{
return GetKeyState(VK_CAPITAL) == 1;
}
bool WinUtils::isHighContrastMode() const
{
QSettings settings(R"(HKEY_CURRENT_USER\Control Panel\Accessibility\HighContrast)", QSettings::NativeFormat);
return (settings.value("Flags").toInt() & 1u) != 0;
}
+1
View File
@@ -36,6 +36,7 @@ public:
bool isLaunchAtStartupEnabled() const override;
void setLaunchAtStartup(bool enable) override;
bool isCapslockEnabled() override;
bool isHighContrastMode() const;
protected:
explicit WinUtils(QObject* parent = nullptr);