From e475325373ce391090ba6b211a1107f8b0ce7178 Mon Sep 17 00:00:00 2001 From: collecting Date: Sat, 4 Oct 2025 10:07:08 +0000 Subject: [PATCH] Edit configure_graphics.cpp --- .../configuration/configure_graphics.cpp | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/citron/configuration/configure_graphics.cpp b/src/citron/configuration/configure_graphics.cpp index f3910ebaf..42ef5de66 100644 --- a/src/citron/configuration/configure_graphics.cpp +++ b/src/citron/configuration/configure_graphics.cpp @@ -591,3 +591,35 @@ Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { } return selected_backend; } + +QString ConfigureGraphics::GetTemplateStyleSheet() const { + return m_template_style_sheet; +} + +void ConfigureGraphics::SetTemplateStyleSheet(const QString& sheet) { + if (m_template_style_sheet == sheet) { + return; + } + + m_template_style_sheet = sheet; + + // Get the current accent color from the global UI settings + const QColor accent_color(QString::fromStdString(UISettings::values.accent_color.GetValue())); + + // Create color variations for hover and pressed states + const QColor accent_color_hover = accent_color.lighter(115); + const QColor accent_color_pressed = accent_color.darker(115); + + QString final_style = m_template_style_sheet; + + // Replace all placeholders with the actual color values in #RRGGBB format + // Use QStringLiteral() to satisfy Qt 6's explicit string constructor requirements + final_style.replace(QStringLiteral("%%ACCENT_COLOR%%"), accent_color.name(QColor::HexRgb)); + final_style.replace(QStringLiteral("%%ACCENT_COLOR_HOVER%%"), accent_color_hover.name(QColor::HexRgb)); + final_style.replace(QStringLiteral("%%ACCENT_COLOR_PRESSED%%"), accent_color_pressed.name(QColor::HexRgb)); + + // Apply the processed stylesheet to this widget and all its children (like checkboxes) + this->setStyleSheet(final_style); + + emit TemplateStyleSheetChanged(); +}