mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
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:
parent
0070d5f295
commit
a32147182a
@ -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") {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user