mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-27 00:35:27 -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
3 changed files with 12 additions and 0 deletions
|
@ -147,6 +147,11 @@ void Application::applyTheme()
|
||||||
auto appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
|
auto appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
|
||||||
if (appTheme == "auto") {
|
if (appTheme == "auto") {
|
||||||
appTheme = osUtils->isDarkMode() ? "dark" : "light";
|
appTheme = osUtils->isDarkMode() ? "dark" : "light";
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (winUtils()->isHighContrastMode()) {
|
||||||
|
appTheme = "classic";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appTheme == "light") {
|
if (appTheme == "light") {
|
||||||
|
|
|
@ -105,3 +105,9 @@ bool WinUtils::isCapslockEnabled()
|
||||||
{
|
{
|
||||||
return GetKeyState(VK_CAPITAL) == 1;
|
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;
|
bool isLaunchAtStartupEnabled() const override;
|
||||||
void setLaunchAtStartup(bool enable) override;
|
void setLaunchAtStartup(bool enable) override;
|
||||||
bool isCapslockEnabled() override;
|
bool isCapslockEnabled() override;
|
||||||
|
bool isHighContrastMode() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WinUtils(QObject* parent = nullptr);
|
explicit WinUtils(QObject* parent = nullptr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue