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

Method mapPlotAreaToParent

src/backend/worksheet/WorksheetElement.cpp:1082–1093  ·  view source on GitHub ↗

! * \brief WorksheetElementPrivate::mapPlotAreaToParent * Mapping a point from the PlotArea (CartesianPlot::plotArea) coordinates to the parent * coordinates of this item * 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 i

Source from the content-addressed store, hash-verified

1080 * \return point in parent coordinates
1081 */
1082QPointF WorksheetElementPrivate::mapPlotAreaToParent(QPointF point) const {
1083 auto* parent = q->parent(AspectType::CartesianPlot);
1084 if (parent) {
1085 auto* plot = static_cast<CartesianPlot*>(parent);
1086 // first mapping to item coordinates and from there back to parent
1087 // WorksheetinfoElement: parentItem()->parentItem() == plot->graphicsItem()
1088 // plot->graphicsItem().pos() == plot->plotArea()->graphicsItem().pos()
1089 return mapToParent(mapFromItem(plot->plotArea()->graphicsItem(), point));
1090 }
1091
1092 return point; // don't map if no parent set. Then it's during load
1093}
1094
1095void WorksheetElementPrivate::hoverEnterEvent(QGraphicsSceneHoverEvent*) {
1096 if (!isSelected())

Callers

nothing calls this directly

Calls 3

plotAreaMethod · 0.80
parentMethod · 0.45
graphicsItemMethod · 0.45

Tested by

no test coverage detected