MCPcopy Create free account
hub / github.com/KDE/labplot / addInfoElement

Method addInfoElement

src/backend/worksheet/plots/cartesian/CartesianPlot.cpp:2141–2159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2139}
2140
2141void CartesianPlot::addInfoElement() {
2142 XYCurve* curve = nullptr;
2143 auto curves = children<XYCurve>();
2144 if (curves.count())
2145 curve = curves.first();
2146
2147 double pos;
2148 Q_D(CartesianPlot);
2149 if (d->calledFromContextMenu) {
2150 pos = d->logicalPos.x();
2151 d->calledFromContextMenu = false;
2152 } else
2153 pos = range(Dimension::X).center();
2154
2155 auto* element = new InfoElement(i18n("Info Element"), this, curve, pos);
2156 this->addChild(element);
2157 element->setParentGraphicsItem(graphicsItem());
2158 element->retransform(); // must be done, because the element must be retransformed (see https://invent.kde.org/marmsoler/labplot/issues/9)
2159}
2160
2161void CartesianPlot::addTextLabel() {
2162 auto* label = new TextLabel(i18n("Text Label"), this);

Callers

nothing calls this directly

Calls 6

xMethod · 0.80
countMethod · 0.45
centerMethod · 0.45
addChildMethod · 0.45
setParentGraphicsItemMethod · 0.45
retransformMethod · 0.45

Tested by

no test coverage detected