From bd4c5eace081393cc92ad610612d7536eb20f537 Mon Sep 17 00:00:00 2001 From: luisangelsm Date: Tue, 20 Jan 2026 20:41:04 +0100 Subject: [PATCH] Make Themable keep the current theme for convenience --- YACReader/viewer.cpp | 4 ++-- common/themes/themable.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index fa7e1503..15d12ace 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -1007,7 +1007,7 @@ void Viewer::showCursor() void Viewer::updateOptions() { goToFlow->setFlowType(Configuration::getConfiguration().getFlowType()); - updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor(ThemeManager::instance().getCurrentTheme().viewer.defaultBackgroundColor)); + updateBackgroundColor(Configuration::getConfiguration().getBackgroundColor(theme.viewer.defaultBackgroundColor)); updateContentSize(); updateInformation(); } @@ -1092,7 +1092,7 @@ void Viewer::updateConfig(QSettings *settings) goToFlow->updateConfig(settings); QPalette palette; - palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor(ThemeManager::instance().getCurrentTheme().viewer.defaultBackgroundColor)); + palette.setColor(backgroundRole(), Configuration::getConfiguration().getBackgroundColor(theme.viewer.defaultBackgroundColor)); setPalette(palette); } diff --git a/common/themes/themable.h b/common/themes/themable.h index 1915bee8..45516270 100644 --- a/common/themes/themable.h +++ b/common/themes/themable.h @@ -12,13 +12,16 @@ protected: &ThemeManager::themeChanged, owner, [this]() { - applyTheme(ThemeManager::instance().getCurrentTheme()); + theme = ThemeManager::instance().getCurrentTheme(); + applyTheme(theme); }); applyTheme(ThemeManager::instance().getCurrentTheme()); } virtual void applyTheme(const Theme &theme) = 0; + + Theme theme; }; #endif // THEMABLE_H