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

Method draw

pj_plotting/widget/src/PlotLegend.cpp:43–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void PlotLegend::draw(QPainter* painter, const QwtScaleMap& x_map, const QwtScaleMap& y_map, const QRectF& rect) const {
44 if (!collapsed_) {
45 QwtPlotLegendItem::draw(painter, x_map, y_map, rect);
46 }
47
48 QRectF icon_rect = hideButtonRect();
49 if (!isVisible() || plotItems().empty()) {
50 return;
51 }
52
53 painter->save();
54 const QColor color = parent_plot_->canvas()->palette().windowText().color();
55 painter->setPen(color);
56 painter->setBrush(QBrush(Qt::white, Qt::SolidPattern));
57 painter->drawEllipse(icon_rect);
58
59 if (collapsed_) {
60 icon_rect -= QMarginsF(3, 3, 3, 3);
61 painter->setBrush(QBrush(color, Qt::SolidPattern));
62 painter->drawEllipse(icon_rect);
63 }
64 painter->restore();
65}
66
67void PlotLegend::drawLegendData(
68 QPainter* painter, const QwtPlotItem* plot_item, const QwtLegendData& data, const QRectF& rect) const {

Callers 2

drawLegendDataMethod · 0.45
renderMethod · 0.45

Calls 9

drawFunction · 0.85
paletteMethod · 0.80
QBrushClass · 0.50
emptyMethod · 0.45
colorMethod · 0.45
canvasMethod · 0.45
setPenMethod · 0.45
setBrushMethod · 0.45
drawEllipseMethod · 0.45

Tested by

no test coverage detected