| 377 | } |
| 378 | |
| 379 | void PackProfile::insertComponent(size_t index, ComponentPtr component) |
| 380 | { |
| 381 | auto id = component->getID(); |
| 382 | if (id.isEmpty()) { |
| 383 | qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Attempt to add a component with empty ID!"; |
| 384 | return; |
| 385 | } |
| 386 | if (d->componentIndex.contains(id)) { |
| 387 | qCWarning(instanceProfileC) << d->m_instance->name() << "|" << "Attempt to add a component that is already present!"; |
| 388 | return; |
| 389 | } |
| 390 | beginInsertRows(QModelIndex(), static_cast<int>(index), static_cast<int>(index)); |
| 391 | d->components.insert(index, component); |
| 392 | d->componentIndex[id] = component; |
| 393 | endInsertRows(); |
| 394 | connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); |
| 395 | scheduleSave(); |
| 396 | } |
| 397 | |
| 398 | void PackProfile::componentDataChanged() |
| 399 | { |
no test coverage detected