diff --git a/GUI/Model/Sample/CompoundItem.cpp b/GUI/Model/Sample/CompoundItem.cpp index cd11e8571b421b752a67be44f05bd6f33ea735c9..4bf979a4acffa8cf14cca3f58c03af49b42214eb 100644 --- a/GUI/Model/Sample/CompoundItem.cpp +++ b/GUI/Model/Sample/CompoundItem.cpp @@ -86,7 +86,9 @@ void CompoundItem::readFrom(QXmlStreamReader* r) // particle } else if (tag == Tag::Particle) { - addItemWithParticleSelection(nullptr).readFrom(r, m_materials); + PolyItem<ParticlesCatalog> p; + p.readFrom(r, m_materials); + m_particles.emplace_item_back(p.releaseItem()); XML::gotoEndElementOfTag(r, tag); // compound groupbox: is expanded? @@ -132,10 +134,9 @@ QVector<ItemWithParticles*> CompoundItem::itemsWithParticles() const return m_particles.toModifiableQVector(); } -PolyItem<ParticlesCatalog>& CompoundItem::addItemWithParticleSelection(ItemWithParticles* particle) +void CompoundItem::addItemWithParticleSelection(ItemWithParticles* particle) { m_particles.emplace_item_back(particle); - return m_particles.back(); } void CompoundItem::removeItemWithParticle(ItemWithParticles* particle) diff --git a/GUI/Model/Sample/CompoundItem.h b/GUI/Model/Sample/CompoundItem.h index db54c61fe0c7d3e4c255af098a55dee151afe734..f903c6802696610beb662dc81de24c11fa75b765 100644 --- a/GUI/Model/Sample/CompoundItem.h +++ b/GUI/Model/Sample/CompoundItem.h @@ -33,7 +33,8 @@ public: std::unique_ptr<Compound> createCompound() const; QVector<ItemWithParticles*> itemsWithParticles() const; - PolyItem<ParticlesCatalog>& addItemWithParticleSelection(ItemWithParticles* particle); + + void addItemWithParticleSelection(ItemWithParticles* particle); void removeItemWithParticle(ItemWithParticles* particle); QVector<ItemWithParticles*> containedItemsWithParticles() const override;