From 6b7e7555dfc0fcb622517e61b345f83f3864669d Mon Sep 17 00:00:00 2001 From: Paul Johnson Date: Sat, 6 Dec 2025 10:03:48 +0000 Subject: [PATCH] Fix calendar chart color issue (#4739) --- src/Charts/CalendarWindow.cpp | 9 ++++++++- src/Charts/CalendarWindow.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Charts/CalendarWindow.cpp b/src/Charts/CalendarWindow.cpp index 7b8d49317..695679e65 100644 --- a/src/Charts/CalendarWindow.cpp +++ b/src/Charts/CalendarWindow.cpp @@ -161,6 +161,14 @@ CalendarWindow::CalendarWindow(Context *context) }); } +void +CalendarWindow::showEvent(QShowEvent*) +{ + // When the chart is added to the Perspective's QStackedWidget, the Perspective's style sheets + // can conflict with the local calendar palette settings causing the appearance to be lost. + // Therefore re-apply the palette upon showEvent to ensure correct calendar appearance. + PaletteApplier::setPaletteRecursively(this, palette, true); +} int CalendarWindow::getDefaultView @@ -467,7 +475,6 @@ CalendarWindow::configChanged inactiveText = GCColor::inactiveColor(activeText, 2.5); } - QPalette palette; palette.setColor(QPalette::Active, QPalette::Window, activeWindow); palette.setColor(QPalette::Active, QPalette::WindowText, activeText); palette.setColor(QPalette::Active, QPalette::Base, activeBase); diff --git a/src/Charts/CalendarWindow.h b/src/Charts/CalendarWindow.h index bf1abecfd..a4934e70a 100644 --- a/src/Charts/CalendarWindow.h +++ b/src/Charts/CalendarWindow.h @@ -93,10 +93,15 @@ class CalendarWindow : public GcChartWindow void setSummaryMetrics(const QStringList &summaryMetrics); void configChanged(qint32); + protected: + + void showEvent(QShowEvent*) override; + private: Context *context; bool first = true; + QPalette palette; QComboBox *defaultViewCombo; QComboBox *firstDayOfWeekCombo; QSpinBox *startHourSpin;