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

Method handleAspectAdded

src/backend/worksheet/WorksheetElementContainer.cpp:161–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void WorksheetElementContainer::handleAspectAdded(const AbstractAspect* aspect) {
162 Q_D(WorksheetElementContainer);
163
164 const auto* element = qobject_cast<const WorksheetElement*>(aspect);
165 if (element && (aspect->parentAspect() == this)) {
166 connect(element, &WorksheetElement::hovered, this, &WorksheetElementContainer::childHovered);
167 connect(element, &WorksheetElement::unhovered, this, &WorksheetElementContainer::childUnhovered);
168 connect(element, &WorksheetElement::changed, this, &WorksheetElementContainer::childChanged);
169 element->graphicsItem()->setParentItem(d);
170
171 qreal zVal = 0;
172 for (auto* child : children<WorksheetElement>(ChildIndexFlag::IncludeHidden))
173 child->setZValue(zVal++);
174 }
175
176 if (!isLoading())
177 d->recalcShapeAndBoundingRect();
178}
179
180/*!
181 * called when one of the children was moved, re-adjusts the Z-values for all children.

Callers

nothing calls this directly

Calls 4

parentAspectMethod · 0.80
graphicsItemMethod · 0.45
setZValueMethod · 0.45

Tested by

no test coverage detected