| 610 | } |
| 611 | |
| 612 | void PackProfile::insertComponent(size_t index, ComponentPtr component) |
| 613 | { |
| 614 | auto id = component->getID(); |
| 615 | if(id.isEmpty()) |
| 616 | { |
| 617 | qWarning() << "Attempt to add a component with empty ID!"; |
| 618 | return; |
| 619 | } |
| 620 | if(d->componentIndex.contains(id)) |
| 621 | { |
| 622 | qWarning() << "Attempt to add a component that is already present!"; |
| 623 | return; |
| 624 | } |
| 625 | beginInsertRows(QModelIndex(), index, index); |
| 626 | d->components.insert(index, component); |
| 627 | d->componentIndex[id] = component; |
| 628 | endInsertRows(); |
| 629 | connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); |
| 630 | scheduleSave(); |
| 631 | } |
| 632 | |
| 633 | void PackProfile::componentDataChanged() |
| 634 | { |
no test coverage detected