| 775 | } |
| 776 | |
| 777 | void PlotWidget::onChangeCurveColor(const QString& curve_name, QColor new_color) { |
| 778 | CurveInfo* info = curveFromTitle(curve_name); |
| 779 | if (info != nullptr && info->curve != nullptr) { |
| 780 | info->curve->setPen(new_color, info->curve->pen().widthF()); |
| 781 | // Remember the override so the curve keeps this color when re-dragged into |
| 782 | // another plot (issue #68). Keyed by source_name, the same key addCurve uses. |
| 783 | // Time-series only: XY curves are keyed by a composed title and the registry |
| 784 | // is never consulted for them (addCurveXY does not auto-assign from it), so |
| 785 | // writing them here would only add entries nothing reads. |
| 786 | if (CurveColorRegistry* registry = colorRegistryOf(session_); registry != nullptr && !isXYPlot()) { |
| 787 | registry->setColor(info->source_name, new_color.name()); |
| 788 | } |
| 789 | emit curveColorChanged(info->source_name, new_color); |
| 790 | replot(); |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | void PlotWidget::setCurveLineWidth(const QString& curve_name, double width) { |
| 795 | CurveInfo* info = curveFromTitle(curve_name); |