Use fusions own palette.

Took 6 minutes
This commit is contained in:
Lukas Brübach 2026-04-07 10:50:38 +02:00
parent 3ec9ae9772
commit 4cc324e1f1

View file

@ -332,13 +332,15 @@ void ThemeManager::themeChangedSlot()
} }
if (themeName == FUSION_THEME_NAME) { if (themeName == FUSION_THEME_NAME) {
qApp->setStyle(QStyleFactory::create("Fusion")); QStyle *fusionStyle = QStyleFactory::create("Fusion");
qApp->setStyle(fusionStyle);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
QPalette palette; // Start from Fusion's own palette so dark mode is handled correctly,
// then apply any tweaks on top of it.
QPalette palette = fusionStyle->standardPalette();
if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark) { if (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark) {
palette.setColor(QPalette::AlternateBase, QColor(53, 53, 53)); palette.setColor(QPalette::AlternateBase, QColor(53, 53, 53));
} }
qApp->setPalette(palette); qApp->setPalette(palette);
#endif #endif
} else if (themeName == FUSION_THEME_NAME_LIGHT) { } else if (themeName == FUSION_THEME_NAME_LIGHT) {