| 2159 | } |
| 2160 | |
| 2161 | void CartesianPlot::addTextLabel() { |
| 2162 | auto* label = new TextLabel(i18n("Text Label"), this); |
| 2163 | |
| 2164 | Q_D(CartesianPlot); |
| 2165 | if (d->calledFromContextMenu) { |
| 2166 | auto position = label->position(); |
| 2167 | position.point = label->parentPosToRelativePos(d->scenePos, position); |
| 2168 | position.point = label->align(position.point, label->graphicsItem()->boundingRect(), label->horizontalAlignment(), label->verticalAlignment(), false); |
| 2169 | label->setPosition(position); |
| 2170 | d->calledFromContextMenu = false; |
| 2171 | } |
| 2172 | |
| 2173 | this->addChild(label); |
| 2174 | label->setParentGraphicsItem(graphicsItem()); |
| 2175 | label->retransform(); |
| 2176 | } |
| 2177 | |
| 2178 | void CartesianPlot::addImage() { |
| 2179 | auto* image = new Image(i18n("Image")); |
no test coverage detected