Skip to content
Snippets Groups Projects
Commit 9709a1a2 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

free ParticleLayoutForm from SessionItem

parent fe89be44
No related branches found
No related tags found
1 merge request!570remove SessionModel/Item from SampleModel and all related items
......@@ -46,7 +46,8 @@ ParticleLayoutForm::ParticleLayoutForm(LayerForm* parent, ParticleLayoutItem* la
LayerEditorUtils::createWidgetForItemWithParticles(this, particle, true, ec));
auto* btn = LayerEditorUtils::createAddParticleButton(
this, [=](const QString& cls) { ec->addParticle(layoutItem, cls); });
this, [=](FormFactorItemCatalog::Type type) { ec->addParticle(layoutItem, type); },
[=](ItemWithParticlesCatalog::Type type) { ec->addParticle(layoutItem, type); });
m_structureEditingWidgets << btn;
layouter.addStructureEditingRow(btn);
......@@ -77,16 +78,14 @@ ParticleLayoutItem* ParticleLayoutForm::layoutItem() const
return m_layoutItem;
}
void ParticleLayoutForm::onParticleAdded(SessionItem* new_item)
void ParticleLayoutForm::onParticleAdded(ItemWithParticles* p)
{
if (auto* p = dynamic_cast<ItemWithParticles*>(new_item)) {
int index = m_layoutItem->particles().indexOf(p);
const int rowInLayout =
m_layout->rowCount() - 1 - (m_layoutItem->particles().size() - 1) + index; // -1: btn
m_layout->insertRow(
rowInLayout, LayerEditorUtils::createWidgetForItemWithParticles(this, p, true, m_ec));
}
int index = m_layoutItem->particles().indexOf(p);
const int rowInLayout =
m_layout->rowCount() - 1 - (m_layoutItem->particles().size() - 1) + index; // -1: btn
m_layout->insertRow(rowInLayout,
LayerEditorUtils::createWidgetForItemWithParticles(this, p, true, m_ec));
}
void ParticleLayoutForm::onAboutToRemoveParticle(ItemWithParticles* item)
......
......@@ -23,7 +23,6 @@ class SampleEditorController;
class QFormLayout;
class ParticleLayoutItem;
class LayerForm;
class SessionItem;
class ItemWithParticles;
class DoubleSpinBox;
class LayerItem;
......@@ -38,7 +37,7 @@ public:
void enableStructureEditing(bool b);
ParticleLayoutItem* layoutItem() const;
void onParticleAdded(SessionItem* item);
void onParticleAdded(ItemWithParticles* item);
void onAboutToRemoveParticle(ItemWithParticles* item);
//! Disable/enable total density property depending on type of interference function.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment