! * helper function: checks whether \c aspect or one of its children has the \c GraphicsItem \c item * Returns a pointer to \c WorksheetElement having this item. */
| 482 | * Returns a pointer to \c WorksheetElement having this item. |
| 483 | */ |
| 484 | WorksheetElement* Worksheet::aspectFromGraphicsItem(const WorksheetElement* parent, const QGraphicsItem* item) const { |
| 485 | if (parent->graphicsItem() == item) |
| 486 | return const_cast<WorksheetElement*>(parent); |
| 487 | else { |
| 488 | for (const auto* child : parent->children<WorksheetElement>(AbstractAspect::ChildIndexFlag::IncludeHidden)) { |
| 489 | WorksheetElement* a = this->aspectFromGraphicsItem(child, item); |
| 490 | if (a) |
| 491 | return a; |
| 492 | } |
| 493 | return nullptr; |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /*! |
| 498 | Selects or deselects the worksheet in the project explorer. |
no test coverage detected