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

Method reparent

src/backend/core/AbstractAspect.cpp:639–655  ·  view source on GitHub ↗

* \brief Move a child to another parent aspect and transfer ownership. */

Source from the content-addressed store, hash-verified

637 * \brief Move a child to another parent aspect and transfer ownership.
638 */
639void AbstractAspect::reparent(AbstractAspect* newParent, int newIndex) {
640 Q_ASSERT(parentAspect());
641 Q_ASSERT(newParent);
642 int max_index = newParent->childCount<AbstractAspect>(ChildIndexFlag::IncludeHidden);
643 if (newIndex == -1)
644 newIndex = max_index;
645 Q_ASSERT(newIndex >= 0 && newIndex <= max_index);
646
647 // AbstractAspect* old_parent = parentAspect();
648 // int old_index = old_parent->indexOfChild<AbstractAspect>(this, IncludeHidden);
649 // auto* old_sibling = old_parent->child<AbstractAspect>(old_index+1, IncludeHidden);
650 // auto* new_sibling = newParent->child<AbstractAspect>(newIndex, IncludeHidden);
651
652 // Q_EMIT newParent->aspectAboutToBeAdded(newParent, new_sibling, this);
653 exec(new AspectChildReparentCmd(parentAspect()->d, newParent->d, this, newIndex));
654 // Q_EMIT old_parent->aspectRemoved(old_parent, old_sibling, this);
655}
656
657QVector<AbstractAspect*> AbstractAspect::children(AspectType type, ChildIndexFlags flags) const {
658 QVector<AbstractAspect*> result;

Callers 5

processDropEventMethod · 0.45
processDropEventMethod · 0.45
addMQTTSubscriptionMethod · 0.45
reparentTopicMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected