| 76 | } |
| 77 | |
| 78 | void 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 | |
| 99 | bool PlotFocusOverlay::eventFilter(QObject* watched, QEvent* event) { |
| 100 | if (watched == container_) { |
nothing calls this directly
no test coverage detected