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

Method insertChild

src/backend/core/AbstractAspect.cpp:555–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555void AbstractAspect::insertChild(AbstractAspect* child, int index) {
556 Q_CHECK_PTR(child);
557 if (index == -1)
558 index = d->m_children.count();
559
560 const auto* before = this->child<AbstractAspect>(index);
561 QString new_name = uniqueNameFor(child->name());
562 beginMacro(before ? i18n("%1: insert %2 before %3", name(), new_name, before->name()) : i18n("%1: insert %2 before end", name(), new_name));
563 if (new_name != child->name()) {
564 info(i18n(R"(Renaming "%1" to "%2" in order to avoid name collision.)", child->name(), new_name));
565 child->setName(new_name);
566 }
567
568 exec(new AspectChildAddCmd(d, child, index));
569 endMacro();
570}
571
572/**
573 * \brief Insert the given Aspect at a specific position in my list of children.without any checks and without putting this step onto the undo-stack

Callers 5

addChildFastMethod · 0.80
insertChildBeforeFastMethod · 0.80
undoMethod · 0.80
redoMethod · 0.80
undoMethod · 0.80

Calls 7

insertMethod · 0.80
parentAspectMethod · 0.80
setParentAspectMethod · 0.80
connectChildMethod · 0.80
countMethod · 0.45
nameMethod · 0.45
setNameMethod · 0.45

Tested by

no test coverage detected