! Returns the QCPPlottableLegendItem which is associated with \a plottable (e.g. a \ref QCPGraph*). If such an item isn't in the legend, returns \c nullptr. \see hasItemWithPlottable */
| 19366 | \see hasItemWithPlottable |
| 19367 | */ |
| 19368 | QCPPlottableLegendItem *QCPLegend::itemWithPlottable(const QCPAbstractPlottable *plottable) const |
| 19369 | { |
| 19370 | for (int i=0; i<itemCount(); ++i) |
| 19371 | { |
| 19372 | if (QCPPlottableLegendItem *pli = qobject_cast<QCPPlottableLegendItem*>(item(i))) |
| 19373 | { |
| 19374 | if (pli->plottable() == plottable) |
| 19375 | return pli; |
| 19376 | } |
| 19377 | } |
| 19378 | return nullptr; |
| 19379 | } |
| 19380 | |
| 19381 | /*! |
| 19382 | Returns the number of items currently in the legend. It is identical to the base class |
no test coverage detected