MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / insertComponent

Method insertComponent

launcher/minecraft/PackProfile.cpp:401–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401void 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
422void PackProfile::componentDataChanged()
423{

Callers 1

resolveDependenciesMethod · 0.80

Calls 6

QModelIndexClass · 0.85
getIDMethod · 0.80
isEmptyMethod · 0.80
insertMethod · 0.80
containsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected