| 159 | } |
| 160 | |
| 161 | void 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. |
nothing calls this directly
no test coverage detected