MCPcopy Create free account
hub / github.com/LUX-Core/lux / registerPlottable

Method registerPlottable

src/qt/qcustomplot.cpp:15433–15453  ·  view source on GitHub ↗

! \internal Registers the specified plottable with this QCustomPlot and, if \ref setAutoAddPlottableToLegend is enabled, adds it to the legend (QCustomPlot::legend). QCustomPlot takes ownership of the plottable. Returns true on success, i.e. when \a plottable isn't already in this plot and the parent plot of \a plottable is this QCustomPlot. This method is called automatically

Source from the content-addressed store, hash-verified

15431 This method is called automatically in the QCPAbstractPlottable base class constructor.
15432*/
15433bool QCustomPlot::registerPlottable(QCPAbstractPlottable *plottable)
15434{
15435 if (mPlottables.contains(plottable))
15436 {
15437 qDebug() << Q_FUNC_INFO << "plottable already added to this QCustomPlot:" << reinterpret_cast<quintptr>(plottable);
15438 return false;
15439 }
15440 if (plottable->parentPlot() != this)
15441 {
15442 qDebug() << Q_FUNC_INFO << "plottable not created with this QCustomPlot as parent:" << reinterpret_cast<quintptr>(plottable);
15443 return false;
15444 }
15445
15446 mPlottables.append(plottable);
15447 // possibly add plottable to legend:
15448 if (mAutoAddPlottableToLegend)
15449 plottable->addToLegend();
15450 if (!plottable->layer()) // usually the layer is already set in the constructor of the plottable (via QCPLayerable constructor)
15451 plottable->setLayer(currentLayer());
15452 return true;
15453}
15454
15455/*! \internal
15456

Callers 1

QCPAbstractPlottableMethod · 0.80

Calls 5

addToLegendMethod · 0.80
layerMethod · 0.80
setLayerMethod · 0.80
containsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected