| 108 | } |
| 109 | |
| 110 | void PlotLegend::drawBackground(QPainter* painter, const QRectF& rect) const { |
| 111 | painter->save(); |
| 112 | QPen pen = textPen(); |
| 113 | QColor border = parent_plot_->canvas()->palette().windowText().color(); |
| 114 | border.setAlphaF(0.4); |
| 115 | pen.setColor(border); |
| 116 | painter->setPen(pen); |
| 117 | QColor background = parent_plot_->palette().window().color(); |
| 118 | if (!background.isValid() || background.alpha() == 0) { |
| 119 | background = parent_plot_->canvas()->palette().window().color(); |
| 120 | } |
| 121 | background.setAlphaF(0.4); |
| 122 | painter->setBrush(background); |
| 123 | const double radius = borderRadius(); |
| 124 | painter->drawRoundedRect(rect, radius, radius); |
| 125 | painter->restore(); |
| 126 | } |
| 127 | |
| 128 | const QwtPlotItem* PlotLegend::itemAt(const QPoint& pos) const { |
| 129 | const QRect canvas_rect = parent_plot_->canvas()->rect(); |