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

Method mapParentToPlotArea

src/backend/worksheet/WorksheetElement.cpp:1062–1071  ·  view source on GitHub ↗

! * \brief WorksheetElementPrivate::mapParentToPlotArea * Mapping a point from parent coordinates to plotArea coordinates * Needed because in some cases the parent is not the PlotArea, but a child of it (Marker/InfoElement) * IMPORTANT: function is also used in Custompoint, so when changing anything, change it also there * \param point point in parent coordinates * \return point in PlotArea

Source from the content-addressed store, hash-verified

1060 * \return point in PlotArea coordinates
1061 */
1062QPointF WorksheetElementPrivate::mapParentToPlotArea(QPointF point) const {
1063 auto* parent = q->parent(AspectType::CartesianPlot);
1064 if (parent) {
1065 auto* plot = static_cast<CartesianPlot*>(parent);
1066 // mapping from parent to item coordinates and them to plot area
1067 return mapToItem(plot->plotArea()->graphicsItem(), mapFromParent(point));
1068 }
1069
1070 return point; // don't map if no parent set. Then it's during load
1071}
1072
1073/*!
1074 * \brief WorksheetElementPrivate::mapPlotAreaToParent

Callers

nothing calls this directly

Calls 3

plotAreaMethod · 0.80
parentMethod · 0.45
graphicsItemMethod · 0.45

Tested by

no test coverage detected