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

Method paintEvent

pj_plotting/widget/src/PlotFocusOverlay.cpp:78–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void PlotFocusOverlay::paintEvent(QPaintEvent* /*event*/) {
79 QPainter painter(this);
80 const QRect container_rect = container_->rect();
81
82 auto rect_for = [this](ads::CDockAreaWidget* area) -> QRect {
83 if (area == nullptr) {
84 return {};
85 }
86 const QPoint top_left = area->mapTo(container_, QPoint(0, 0));
87 return {top_left, area->size()};
88 };
89
90 // Hover only paints when it differs from focus (focus wins under cursor).
91 if (hovered_area_ != nullptr && hovered_area_ != focused_area_) {
92 paintFrame(painter, rect_for(hovered_area_), container_rect, kHoverColor);
93 }
94 if (focused_area_ != nullptr) {
95 paintFrame(painter, rect_for(focused_area_), container_rect, kFocusColor);
96 }
97}
98
99bool PlotFocusOverlay::eventFilter(QObject* watched, QEvent* event) {
100 if (watched == container_) {

Callers

nothing calls this directly

Calls 4

paintFrameFunction · 0.85
rectMethod · 0.80
QPointClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected