MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / registerItem

Method registerItem

qcustomplot/qcustomplot.cpp:15518–15535  ·  view source on GitHub ↗

! \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. */

Source from the content-addressed store, hash-verified

15516 This method is called automatically in the QCPAbstractItem base class constructor.
15517*/
15518bool QCustomPlot::registerItem(QCPAbstractItem *item)
15519{
15520 if (mItems.contains(item))
15521 {
15522 qDebug() << Q_FUNC_INFO << "item already added to this QCustomPlot:" << reinterpret_cast<quintptr>(item);
15523 return false;
15524 }
15525 if (item->parentPlot() != this)
15526 {
15527 qDebug() << Q_FUNC_INFO << "item not created with this QCustomPlot as parent:" << reinterpret_cast<quintptr>(item);
15528 return false;
15529 }
15530
15531 mItems.append(item);
15532 if (!item->layer()) // usually the layer is already set in the constructor of the item (via QCPLayerable constructor)
15533 item->setLayer(currentLayer());
15534 return true;
15535}
15536
15537/*! \internal
15538

Callers 1

QCPAbstractItemMethod · 0.80

Calls 4

containsMethod · 0.80
appendMethod · 0.80
layerMethod · 0.80
setLayerMethod · 0.80

Tested by

no test coverage detected