| 399 | } |
| 400 | |
| 401 | void PackProfile::insertComponent(size_t index, ComponentPtr component) |
| 402 | { |
| 403 | auto id = component->getID(); |
| 404 | if(id.isEmpty()) |
| 405 | { |
| 406 | qWarning() << "Attempt to add a component with empty ID!"; |
| 407 | return; |
| 408 | } |
| 409 | if(d->componentIndex.contains(id)) |
| 410 | { |
| 411 | qWarning() << "Attempt to add a component that is already present!"; |
| 412 | return; |
| 413 | } |
| 414 | beginInsertRows(QModelIndex(), index, index); |
| 415 | d->components.insert(index, component); |
| 416 | d->componentIndex[id] = component; |
| 417 | endInsertRows(); |
| 418 | connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); |
| 419 | scheduleSave(); |
| 420 | } |
| 421 | |
| 422 | void PackProfile::componentDataChanged() |
| 423 | { |
no test coverage detected