MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / changeEvent

Method changeEvent

pj_widgets/src/DateRangePicker.cpp:971–1000  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

969}
970
971void DateRangePicker::changeEvent(QEvent* event) {
972 // Re-theme on a live theme toggle. Both StyleChange and PaletteChange are
973 // handled: the app pins QPalette but a theme swap can still arrive as either,
974 // so cover both. The calendars/overlay paint from pickerTokens() (keyed off
975 // the persisted theme), so we re-apply the overlay stylesheet, re-render the
976 // button icon in the new ink, and force a repaint of the overlay subtree
977 // (it lives under window(), not under this widget, so it won't repaint on its
978 // own from a change event delivered here).
979 if (event->type() == QEvent::StyleChange || event->type() == QEvent::PaletteChange) {
980 updateOverlayStyle();
981 if (calendar_button_) {
982 calendar_button_->setIcon(renderThemedIcon(QStringLiteral(":/resources/svg/calendar_month.svg"), 24));
983 }
984 if (arrow_label_) {
985 arrow_label_->setPixmap(
986 renderThemedIcon(QStringLiteral(":/resources/svg/arrow_right_alt.svg"), 18).pixmap(18, 18));
987 }
988 if (dual_calendar_) {
989 dual_calendar_->retheme(); // re-ink the nav chevrons to the new theme
990 }
991 if (overlay_) {
992 const auto children = overlay_->findChildren<QWidget*>();
993 overlay_->update();
994 for (auto* child : children) {
995 child->update();
996 }
997 }
998 }
999 QWidget::changeEvent(event);
1000}
1001
1002void DateRangePicker::updateOverlayStyle() {
1003 if (!overlay_) {

Callers

nothing calls this directly

Calls 6

renderThemedIconFunction · 0.85
setPixmapMethod · 0.80
rethemeMethod · 0.80
typeMethod · 0.45
setIconMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected