! Removes the specified plottable from the plot and deletes it. If necessary, the corresponding legend item is also removed from the default legend (QCustomPlot::legend). Returns true on success. \see clearPlottables */
| 13538 | \see clearPlottables |
| 13539 | */ |
| 13540 | bool QCustomPlot::removePlottable(QCPAbstractPlottable *plottable) |
| 13541 | { |
| 13542 | if (!mPlottables.contains(plottable)) |
| 13543 | { |
| 13544 | qDebug() << Q_FUNC_INFO << "plottable not in list:" << reinterpret_cast<quintptr>(plottable); |
| 13545 | return false; |
| 13546 | } |
| 13547 | |
| 13548 | // remove plottable from legend: |
| 13549 | plottable->removeFromLegend(); |
| 13550 | // special handling for QCPGraphs to maintain the simple graph interface: |
| 13551 | if (QCPGraph *graph = qobject_cast<QCPGraph*>(plottable)) |
| 13552 | mGraphs.removeOne(graph); |
| 13553 | // remove plottable: |
| 13554 | delete plottable; |
| 13555 | mPlottables.removeOne(plottable); |
| 13556 | return true; |
| 13557 | } |
| 13558 | |
| 13559 | /*! \overload |
| 13560 |
nothing calls this directly
no test coverage detected