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

Method childAdded

src/backend/worksheet/InfoElement.cpp:658–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658void InfoElement::childAdded(const AbstractAspect* child) {
659 const auto* point = dynamic_cast<const CustomPoint*>(child);
660 if (point) {
661 auto* p = const_cast<CustomPoint*>(point);
662 // otherwise Custom point must be patched to handle discrete curve points.
663 // This makes it much easier
664 p->graphicsItem()->setFlag(QGraphicsItem::ItemIsMovable, false);
665 p->setParentGraphicsItem(graphicsItem());
666 // Must be done after setCoordinateBindingEnabled, otherwise positionChanged will be called and
667 // then the InfoElement position will be set incorrectly
668 connect(point, &CustomPoint::positionChanged, this, &InfoElement::pointPositionChanged);
669 connect(point, &CustomPoint::visibleChanged, this, &InfoElement::pointVisibleChanged);
670 return;
671 }
672
673 const auto* m_titleChild = dynamic_cast<const TextLabel*>(child);
674 if (m_titleChild) {
675 connect(m_title, &TextLabel::positionChanged, this, &InfoElement::labelPositionChanged);
676 connect(m_title, &TextLabel::visibleChanged, this, &InfoElement::labelVisibleChanged);
677 connect(m_title, &TextLabel::textWrapperChanged, this, &InfoElement::labelTextWrapperChanged);
678 connect(m_title, &TextLabel::borderShapeChanged, this, &InfoElement::labelBorderShapeChanged);
679 connect(m_title, &TextLabel::rotationAngleChanged, this, &InfoElement::retransform);
680
681 auto* l = const_cast<TextLabel*>(m_titleChild);
682 l->setParentGraphicsItem(graphicsItem());
683 }
684}
685
686/*!
687 * \brief InfoElement::currentValue

Callers

nothing calls this directly

Calls 2

graphicsItemMethod · 0.45
setParentGraphicsItemMethod · 0.45

Tested by

no test coverage detected