mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-04 20:18:44 -06:00
Merge pull request #13776 from jordan-woyak/win-dark-mode-styles
DolphinQt: Fix Windows dark theme when using external stylesheets.
This commit is contained in:
@ -175,17 +175,18 @@ void Settings::ApplyStyle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (stylesheet_contents.isEmpty())
|
// Unlike other OSes we don't automatically get a default dark theme on Windows.
|
||||||
{
|
// We manually load a dark palette for our included "(Dark)" style,
|
||||||
// No theme selected or found. Usually we would just fallthrough and set an empty stylesheet
|
// and for *any* external style when the system is in "Dark" mode.
|
||||||
// which would select Qt's default theme, but unlike other OSes we don't automatically get a
|
// Unfortunately it doesn't seem trivial to load a palette based on the stylesheet itself.
|
||||||
// default dark theme on Windows when the user has selected dark mode in the Windows settings.
|
|
||||||
// So manually check if the user wants dark mode and, if yes, load our embedded dark theme.
|
|
||||||
if (style_type == StyleType::Dark || (style_type != StyleType::Light && IsSystemDark()))
|
if (style_type == StyleType::Dark || (style_type != StyleType::Light && IsSystemDark()))
|
||||||
|
{
|
||||||
|
if (stylesheet_contents.isEmpty())
|
||||||
{
|
{
|
||||||
QFile file(QStringLiteral(":/dolphin_dark_win/dark.qss"));
|
QFile file(QStringLiteral(":/dolphin_dark_win/dark.qss"));
|
||||||
if (file.open(QFile::ReadOnly))
|
if (file.open(QFile::ReadOnly))
|
||||||
stylesheet_contents = QString::fromUtf8(file.readAll().data());
|
stylesheet_contents = QString::fromUtf8(file.readAll().data());
|
||||||
|
}
|
||||||
|
|
||||||
QPalette palette = qApp->style()->standardPalette();
|
QPalette palette = qApp->style()->standardPalette();
|
||||||
palette.setColor(QPalette::Window, QColor(32, 32, 32));
|
palette.setColor(QPalette::Window, QColor(32, 32, 32));
|
||||||
@ -209,7 +210,6 @@ void Settings::ApplyStyle()
|
|||||||
if (s_default_palette)
|
if (s_default_palette)
|
||||||
qApp->setPalette(*s_default_palette);
|
qApp->setPalette(*s_default_palette);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define tooltips style if not already defined
|
// Define tooltips style if not already defined
|
||||||
|
Reference in New Issue
Block a user