| 284 | } |
| 285 | |
| 286 | void CurveEditor::refresh() { |
| 287 | // Clear without firing selection-change handlers; we re-evaluate at the end. |
| 288 | QSignalBlocker block_list(ui_->listWidget); |
| 289 | ui_->listWidget->clear(); |
| 290 | // Row swatches are about to be destroyed — invalidate any cached pointer. |
| 291 | clearActivePicker(); |
| 292 | |
| 293 | if (plot_ == nullptr) { |
| 294 | return; |
| 295 | } |
| 296 | |
| 297 | for (const auto& info : plot_->curveList()) { |
| 298 | if (info.curve == nullptr) { |
| 299 | continue; |
| 300 | } |
| 301 | appendRow(info.source_name, info.curve->title().text(), info.curve->pen().color(), info.curve->isVisible()); |
| 302 | } |
| 303 | // Preserve the active filter across refreshes. |
| 304 | applyFilter(); |
| 305 | } |
| 306 | |
| 307 | void CurveEditor::appendRow(const QString& curve_key, const QString& display_name, QColor color, bool visible) { |
| 308 | auto* item = new QListWidgetItem(); |