MCPcopy Create free account
hub / github.com/cutechess/cutechess / registerPlottable

Method registerPlottable

projects/gui/3rdparty/qcustomplot/qcustomplot.cpp:16213–16233  ·  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

16211 This method is called automatically in the QCPAbstractPlottable base class constructor.
16212*/
16213bool QCustomPlot::registerPlottable(QCPAbstractPlottable *plottable)
16214{
16215 if (mPlottables.contains(plottable))
16216 {
16217 qDebug() << Q_FUNC_INFO << "plottable already added to this QCustomPlot:" << reinterpret_cast<quintptr>(plottable);
16218 return false;
16219 }
16220 if (plottable->parentPlot() != this)
16221 {
16222 qDebug() << Q_FUNC_INFO << "plottable not created with this QCustomPlot as parent:" << reinterpret_cast<quintptr>(plottable);
16223 return false;
16224 }
16225
16226 mPlottables.append(plottable);
16227 // possibly add plottable to legend:
16228 if (mAutoAddPlottableToLegend)
16229 plottable->addToLegend();
16230 if (!plottable->layer()) // usually the layer is already set in the constructor of the plottable (via QCPLayerable constructor)
16231 plottable->setLayer(currentLayer());
16232 return true;
16233}
16234
16235/*! \internal
16236

Callers 1

QCPAbstractPlottableMethod · 0.80

Calls 5

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

Tested by

no test coverage detected