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

Method parentRect

src/backend/worksheet/WorksheetElement.cpp:397–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397QRectF WorksheetElement::parentRect() const {
398 QRectF rect;
399 auto* parent = parentAspect();
400 if (parent && parent->type() == AspectType::CartesianPlot && plot()) {
401 if (type() != AspectType::Axis)
402 rect = plot()->graphicsItem()->mapRectFromScene(plot()->rect());
403 else
404 rect = plot()->dataRect(); // axes are positioned relative to the data rect and not to the whole plot rect
405 } else {
406 const auto* parent = graphicsItem()->parentItem();
407 if (parent) {
408 rect = parent->boundingRect();
409 } else {
410 if (graphicsItem()->scene())
411 rect = graphicsItem()->scene()->sceneRect();
412 }
413 }
414
415 return rect;
416}
417
418/*!
419 * \brief parentPosToRelativePos

Callers 4

mouseReleaseEventMethod · 0.80
itemChangeMethod · 0.80

Calls 6

rectMethod · 0.80
dataRectMethod · 0.80
typeMethod · 0.45
graphicsItemMethod · 0.45
boundingRectMethod · 0.45
sceneMethod · 0.45

Tested by

no test coverage detected