| 1404 | } |
| 1405 | |
| 1406 | void Worksheet::curveRemoved(const XYCurve* curve) { |
| 1407 | auto* plot = dynamic_cast<CartesianPlot*>(QObject::sender()); |
| 1408 | if (!plot) |
| 1409 | return; |
| 1410 | |
| 1411 | TreeModel* treeModel = cursorModel(); |
| 1412 | int rowCount = treeModel->rowCount(); |
| 1413 | |
| 1414 | for (int i = 0; i < rowCount; i++) { |
| 1415 | QModelIndex plotIndex = treeModel->index(i, static_cast<int>(WorksheetPrivate::TreeModelColumn::PLOTNAME)); |
| 1416 | if (plotIndex.data().toString().compare(plot->name()) != 0) |
| 1417 | continue; |
| 1418 | |
| 1419 | int curveCount = treeModel->rowCount(plotIndex); |
| 1420 | for (int j = 0; j < curveCount; j++) { |
| 1421 | QModelIndex curveIndex = treeModel->index(j, static_cast<int>(WorksheetPrivate::TreeModelColumn::SIGNALNAME), plotIndex); |
| 1422 | |
| 1423 | if (curveIndex.data().toString().compare(curve->name()) != 0) |
| 1424 | continue; |
| 1425 | treeModel->removeRow(j, plotIndex); |
| 1426 | break; |
| 1427 | } |
| 1428 | break; |
| 1429 | } |
| 1430 | } |
| 1431 | |
| 1432 | /*! |
| 1433 | * Updates the background of the cuves entry in the treeview |