| 553 | } |
| 554 | |
| 555 | void 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 |
no test coverage detected