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

Method aspectFromGraphicsItem

src/backend/worksheet/Worksheet.cpp:484–495  ·  view source on GitHub ↗

! * 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. */

Source from the content-addressed store, hash-verified

482 * Returns a pointer to \c WorksheetElement having this item.
483 */
484WorksheetElement* 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.

Callers 2

setItemSelectedInViewMethod · 0.95

Calls 1

graphicsItemMethod · 0.45

Tested by

no test coverage detected