From d0a77df703ba72839bc1458a0cc4af96d10cde1a Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Sun, 23 Mar 2025 14:29:58 +0000 Subject: [PATCH] Try best to avoid regression Signed-off-by: TheKodeToad (cherry picked from commit 513959750f23719b55030cd34b9a8f5b248289c5) --- launcher/ui/themes/SystemTheme.cpp | 12 ++++++++++++ launcher/ui/themes/SystemTheme.h | 1 + 2 files changed, 13 insertions(+) diff --git a/launcher/ui/themes/SystemTheme.cpp b/launcher/ui/themes/SystemTheme.cpp index 31f6a96ab..59644ddde 100644 --- a/launcher/ui/themes/SystemTheme.cpp +++ b/launcher/ui/themes/SystemTheme.cpp @@ -47,6 +47,18 @@ SystemTheme::SystemTheme(const QString& styleName, bool isDefaultTheme) colorPalette = QStyleFactory::create(styleName)->standardPalette(); } +void SystemTheme::apply(bool initial) +{ + // See https://github.com/MultiMC/Launcher/issues/1790 + // or https://github.com/PrismLauncher/PrismLauncher/issues/490 + if (initial && themeName == "system") { + QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme()))); + return; + } + + ITheme::apply(initial); +} + QString SystemTheme::id() { return themeName; diff --git a/launcher/ui/themes/SystemTheme.h b/launcher/ui/themes/SystemTheme.h index 195b8e368..09db1a322 100644 --- a/launcher/ui/themes/SystemTheme.h +++ b/launcher/ui/themes/SystemTheme.h @@ -40,6 +40,7 @@ class SystemTheme : public ITheme { public: SystemTheme(const QString& styleName, bool isDefaultTheme); virtual ~SystemTheme() {} + void apply(bool initial) override; QString id() override; QString name() override;