| 395 | } |
| 396 | |
| 397 | QRectF 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 |
no test coverage detected