| 228 | } |
| 229 | |
| 230 | PlotWidgetBase::CurveInfo* PlotWidgetBase::addCurve( |
| 231 | const QString& name, QwtSeriesData<QPointF>* series, QColor color, const QString& display_name) { |
| 232 | if (series == nullptr || curveFromTitle(name) != nullptr) { |
| 233 | delete series; |
| 234 | return nullptr; |
| 235 | } |
| 236 | |
| 237 | auto* curve = new QwtPlotCurve(display_name.isEmpty() ? name : display_name); |
| 238 | curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true); |
| 239 | curve->setPaintAttribute(QwtPlotCurve::FilterPointsAggressive, true); |
| 240 | curve->setData(series); |
| 241 | curve->setPen(color == Qt::transparent ? nextColor() : color); |
| 242 | setStyle(curve, curveStyle()); |
| 243 | curve->setRenderHint(QwtPlotItem::RenderAntialiased, true); |
| 244 | curve->attach(qwtPlot()); |
| 245 | |
| 246 | auto* marker = new QwtPlotMarker; |
| 247 | marker->attach(qwtPlot()); |
| 248 | marker->setVisible(false); |
| 249 | marker->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, Qt::red, QPen(Qt::black), QSize(8, 8))); |
| 250 | |
| 251 | plot_->curve_list.push_back(CurveInfo{.source_name = name, .curve = curve, .marker = marker}); |
| 252 | emit curveListChanged(); |
| 253 | return &plot_->curve_list.back(); |
| 254 | } |
| 255 | |
| 256 | void PlotWidgetBase::removeCurve(const QString& title) { |
| 257 | auto it = std::find_if(plot_->curve_list.begin(), plot_->curve_list.end(), [&title](const CurveInfo& info) { |
nothing calls this directly
no test coverage detected