| 2139 | } |
| 2140 | |
| 2141 | void 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 | |
| 2161 | void CartesianPlot::addTextLabel() { |
| 2162 | auto* label = new TextLabel(i18n("Text Label"), this); |
nothing calls this directly
no test coverage detected