| 41 | } |
| 42 | |
| 43 | void 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 | |
| 67 | void PlotLegend::drawLegendData( |
| 68 | QPainter* painter, const QwtPlotItem* plot_item, const QwtLegendData& data, const QRectF& rect) const { |