Paint a 1-px frame at the 4 splitter handles / outer-edge pixels that hug the area's bounding rect (in container coords). For inner edges the line sits one pixel OUTSIDE the area, landing on the adjacent splitter handle. For edges flush with the container's boundary we clamp to the container's edge pixel so the cue isn't clipped away.
| 26 | // splitter handle. For edges flush with the container's boundary we |
| 27 | // clamp to the container's edge pixel so the cue isn't clipped away. |
| 28 | void paintFrame(QPainter& painter, const QRect& rect_in_container, const QRect& container_rect, const QColor& color) { |
| 29 | if (!rect_in_container.isValid() || !container_rect.isValid()) { |
| 30 | return; |
| 31 | } |
| 32 | painter.setPen(QPen(color, 1)); |
| 33 | painter.setBrush(Qt::NoBrush); |
| 34 | const int left = std::max(container_rect.left(), rect_in_container.left() - 1); |
| 35 | const int top = std::max(container_rect.top(), rect_in_container.top() - 1); |
| 36 | const int right = std::min(container_rect.right(), rect_in_container.right() + 1); |
| 37 | const int bottom = std::min(container_rect.bottom(), rect_in_container.bottom() + 1); |
| 38 | painter.drawLine(left, top, right, top); |
| 39 | painter.drawLine(left, bottom, right, bottom); |
| 40 | painter.drawLine(left, top, left, bottom); |
| 41 | painter.drawLine(right, top, right, bottom); |
| 42 | } |
| 43 | } // namespace |
| 44 | |
| 45 | PlotFocusOverlay::PlotFocusOverlay(ads::CDockContainerWidget& container) : QWidget(&container), container_(&container) { |