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;