! 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 */
| 14276 | \see clearPlottables |
| 14277 | */ |
| 14278 | bool QCustomPlot::removePlottable(QCPAbstractPlottable *plottable) |
| 14279 | { |
| 14280 | if (!mPlottables.contains(plottable)) |
| 14281 | { |
| 14282 | qDebug() << Q_FUNC_INFO << "plottable not in list:" << reinterpret_cast<quintptr>(plottable); |
| 14283 | return false; |
| 14284 | } |
| 14285 | |
| 14286 | // remove plottable from legend: |
| 14287 | plottable->removeFromLegend(); |
| 14288 | // special handling for QCPGraphs to maintain the simple graph interface: |
| 14289 | if (QCPGraph *graph = qobject_cast<QCPGraph*>(plottable)) |
| 14290 | mGraphs.removeOne(graph); |
| 14291 | // remove plottable: |
| 14292 | delete plottable; |
| 14293 | mPlottables.removeOne(plottable); |
| 14294 | return true; |
| 14295 | } |
| 14296 | |
| 14297 | /*! \overload |
| 14298 |
nothing calls this directly
no test coverage detected