| 2195 | } |
| 2196 | |
| 2197 | void CartesianPlot::addCustomPoint() { |
| 2198 | Q_D(CartesianPlot); |
| 2199 | auto* point = new CustomPoint(this, i18n("Custom Point")); |
| 2200 | point->setCoordinateSystemIndex(defaultCoordinateSystemIndex()); |
| 2201 | |
| 2202 | beginMacro(i18n("%1: add %2", name(), point->name())); |
| 2203 | |
| 2204 | // must be before setting the position |
| 2205 | this->addChild(point); |
| 2206 | |
| 2207 | if (d->calledFromContextMenu) { |
| 2208 | point->setCoordinateBindingEnabled(true); |
| 2209 | point->setPositionLogical(d->logicalPos); |
| 2210 | d->calledFromContextMenu = false; |
| 2211 | } else { |
| 2212 | auto p = point->position(); |
| 2213 | p.point = QPointF(0, 0); // Exactly in the middle of the plot in scene coordinates |
| 2214 | point->setPosition(p); |
| 2215 | point->setCoordinateBindingEnabled(true); |
| 2216 | } |
| 2217 | |
| 2218 | endMacro(); |
| 2219 | point->retransform(); |
| 2220 | } |
| 2221 | |
| 2222 | void CartesianPlot::addReferenceLine() { |
| 2223 | Q_D(CartesianPlot); |
no test coverage detected