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

Method addNewPoint

src/backend/datapicker/Datapicker.cpp:217–241  ·  view source on GitHub ↗

! * \brief Datapicker::addNewPoint * \param pos position in scene coordinates * \param parentAspect */

Source from the content-addressed store, hash-verified

215 * \param parentAspect
216 */
217void Datapicker::addNewPoint(QPointF pos, AbstractAspect* parentAspect) {
218 auto points = parentAspect->children<DatapickerPoint>(ChildIndexFlag::IncludeHidden);
219
220 auto* newPoint = new DatapickerPoint(i18n("Point %1", points.count() + 1));
221 newPoint->setHidden(true);
222
223 beginMacro(i18n("%1: add %2", parentAspect->name(), newPoint->name()));
224 if (parentAspect->addChild(newPoint)) {
225 const QPointF oldPos = newPoint->position();
226 newPoint->setPosition(pos);
227 if (oldPos == pos) {
228 // Just if pos == oldPos, setPosition will not trigger retransform() then
229 newPoint->retransform();
230 }
231
232 auto* datapickerCurve = static_cast<DatapickerCurve*>(parentAspect);
233 if (m_image == parentAspect)
234 newPoint->setIsReferencePoint(true);
235 else if (datapickerCurve)
236 newPoint->initErrorBar(datapickerCurve->curveErrorTypes());
237 } else
238 delete newPoint;
239 endMacro();
240 Q_EMIT requestUpdateActions();
241}
242
243bool Datapicker::xDateTime() const {
244 return m_image->axisPoints().datetime;

Callers 15

mousePressEventMethod · 0.80
itemChangeMethod · 0.80
linearMappingMethod · 0.80
logarithmic10XMappingMethod · 0.80
logarithmic10YMappingMethod · 0.80
referenceMoveMethod · 0.80
referenceMoveKeyPressMethod · 0.80
curvePointMoveMethod · 0.80

Calls 9

positionMethod · 0.80
setIsReferencePointMethod · 0.80
initErrorBarMethod · 0.80
countMethod · 0.45
setHiddenMethod · 0.45
nameMethod · 0.45
addChildMethod · 0.45
setPositionMethod · 0.45
retransformMethod · 0.45

Tested by 15

linearMappingMethod · 0.64
logarithmic10XMappingMethod · 0.64
logarithmic10YMappingMethod · 0.64
referenceMoveMethod · 0.64
referenceMoveKeyPressMethod · 0.64
curvePointMoveMethod · 0.64
selectReferencePointMethod · 0.64