take default theme name from startup instead of using empty (#6663)

This commit is contained in:
ebbit1q 2026-03-06 00:19:10 +01:00 committed by GitHub
parent 04f06206b7
commit e39bbd2b31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View file

@ -12,6 +12,7 @@
#include <QPixmapCache>
#include <QStandardPaths>
#include <QString>
#include <QStyle>
#include <QStyleFactory>
#include <QStyleHints>
#include <Qt>
@ -89,6 +90,7 @@ struct PaletteColorInfo
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
{
defaultStyleName = qApp->style()->objectName();
ensureThemeDirectoryExists();
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, &ThemeManager::themeChangedSlot);
@ -346,7 +348,7 @@ void ThemeManager::themeChangedSlot()
qApp->setStyle(QStyleFactory::create("Fusion"));
qApp->setPalette(createDarkGreenFusionPalette());
} else {
qApp->setStyle("");
qApp->setStyle(defaultStyleName); // setting the style also sets the palette
}
if (dirPath.isEmpty()) {

View file

@ -40,6 +40,7 @@ public:
};
private:
QString defaultStyleName;
std::array<QBrush, Role::MaxRole + 1> brushes;
QStringMap availableThemes;
/*

View file

@ -46,6 +46,8 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
&HomeWidget::onBackgroundShuffleFrequencyChanged);
// Lambda is cleaner to read than overloading this
connect(&SettingsCache::instance(), &SettingsCache::homeTabDisplayCardNameChanged, this, [this] { repaint(); });
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
&HomeWidget::updateButtonsToBackgroundColor);
}
void HomeWidget::initializeBackgroundFromSource()