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

Function paintFrame

pj_plotting/widget/src/PlotFocusOverlay.cpp:28–42  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
28void 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
45PlotFocusOverlay::PlotFocusOverlay(ads::CDockContainerWidget& container) : QWidget(&container), container_(&container) {

Callers 1

paintEventMethod · 0.85

Calls 5

drawLineMethod · 0.60
QPenClass · 0.50
isValidMethod · 0.45
setPenMethod · 0.45
setBrushMethod · 0.45

Tested by

no test coverage detected