| 2176 | } |
| 2177 | |
| 2178 | void CartesianPlot::addImage() { |
| 2179 | auto* image = new Image(i18n("Image")); |
| 2180 | |
| 2181 | Q_D(CartesianPlot); |
| 2182 | if (d->calledFromContextMenu) { |
| 2183 | auto position = image->position(); |
| 2184 | position.point = image->parentPosToRelativePos(d->scenePos, position); |
| 2185 | position.point = image->align(position.point, image->graphicsItem()->boundingRect(), image->horizontalAlignment(), image->verticalAlignment(), false); |
| 2186 | image->setPosition(position); |
| 2187 | d->calledFromContextMenu = false; |
| 2188 | } |
| 2189 | |
| 2190 | // make the new image somewhat smaller so it's completely visible also on smaller plots |
| 2191 | image->setWidth((int)Worksheet::convertToSceneUnits(1.0, Worksheet::Unit::Centimeter)); |
| 2192 | |
| 2193 | this->addChild(image); |
| 2194 | image->retransform(); |
| 2195 | } |
| 2196 | |
| 2197 | void CartesianPlot::addCustomPoint() { |
| 2198 | Q_D(CartesianPlot); |
no test coverage detected