Minor theme fixes

* Support mouse hover color change for QPushButtons.
* Fix #5040 - don't enforce standard palette when in classic theme mode
This commit is contained in:
Jonathan White 2020-07-26 17:02:02 -04:00
parent 004f5d407f
commit a88fe61a7b
4 changed files with 31 additions and 12 deletions

View File

@ -144,18 +144,19 @@ Application::~Application()
void Application::applyTheme()
{
QString appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
auto appTheme = config()->get(Config::GUI_ApplicationTheme).toString();
if (appTheme == "auto") {
if (osUtils->isDarkMode()) {
setStyle(new DarkStyle);
m_darkTheme = true;
} else {
setStyle(new LightStyle);
}
} else if (appTheme == "light") {
appTheme = osUtils->isDarkMode() ? "dark" : "light";
}
if (appTheme == "light") {
setStyle(new LightStyle);
// Workaround Qt 5.15+ bug
setPalette(style()->standardPalette());
} else if (appTheme == "dark") {
setStyle(new DarkStyle);
// Workaround Qt 5.15+ bug
setPalette(style()->standardPalette());
m_darkTheme = true;
} else {
// Classic mode, don't check for dark theme on Windows
@ -164,8 +165,6 @@ void Application::applyTheme()
m_darkTheme = osUtils->isDarkMode();
#endif
}
setPalette(style()->standardPalette());
}
bool Application::event(QEvent* event)

View File

@ -3,6 +3,11 @@ QPushButton:default {
color: palette(highlighted-text);
}
/* Note: default button hover is defined in the respective theme style */
QPushButton:!default:hover {
background: palette(mid);
}
QSpinBox {
min-width: 90px;
}

View File

@ -8,6 +8,16 @@ EntryPreviewWidget QLineEdit:disabled, EntryPreviewWidget QTextEdit:disabled {
background-color: #424242;
}
QPushButton:!default:hover {
/* Using slightly darker shade from palette(button) */
background: #252528;
}
QPushButton:default:hover {
/* Using slightly lighter shade from palette(highlight) */
background: #2E582E;
}
QToolTip {
color: #BFBFBF;
background-color: #2D532D;

View File

@ -8,11 +8,16 @@ EntryPreviewWidget QLineEdit:disabled, EntryPreviewWidget QTextEdit:disabled {
background-color: #EDEDED;
}
QGroupBox::title {
color: #4B7B19;
QPushButton:default:hover {
/* Using slightly lighter shade from palette(highlight) */
background: #568821;
}
QToolTip {
color: #F9F9F9;
background-color: #4D7F1A;
}
QGroupBox::title {
color: #4B7B19;
}