! \internal Registers the specified item with this QCustomPlot. QCustomPlot takes ownership of the item. Returns true on success, i.e. when \a item wasn't already in the plot and the parent plot of \a item is this QCustomPlot. This method is called automatically in the QCPAbstractItem base class constructor. */
| 16269 | This method is called automatically in the QCPAbstractItem base class constructor. |
| 16270 | */ |
| 16271 | bool QCustomPlot::registerItem(QCPAbstractItem *item) |
| 16272 | { |
| 16273 | if (mItems.contains(item)) |
| 16274 | { |
| 16275 | qDebug() << Q_FUNC_INFO << "item already added to this QCustomPlot:" << reinterpret_cast<quintptr>(item); |
| 16276 | return false; |
| 16277 | } |
| 16278 | if (item->parentPlot() != this) |
| 16279 | { |
| 16280 | qDebug() << Q_FUNC_INFO << "item not created with this QCustomPlot as parent:" << reinterpret_cast<quintptr>(item); |
| 16281 | return false; |
| 16282 | } |
| 16283 | |
| 16284 | mItems.append(item); |
| 16285 | if (!item->layer()) // usually the layer is already set in the constructor of the item (via QCPLayerable constructor) |
| 16286 | item->setLayer(currentLayer()); |
| 16287 | return true; |
| 16288 | } |
| 16289 | |
| 16290 | /*! \internal |
| 16291 |
no test coverage detected