diff --git a/GUI/Models/ItemWithParticles.cpp b/GUI/Models/ItemWithParticles.cpp index 2955bb49b23d2177fbccdc60b1788f54a1130206..84bd20420e0baa42fc322d83ed552e4e01cb11bc 100644 --- a/GUI/Models/ItemWithParticles.cpp +++ b/GUI/Models/ItemWithParticles.cpp @@ -103,14 +103,14 @@ SelectionDescriptor<RotationItem*> ItemWithParticles::rotationMethod() d.currentItem = [=]() -> RotationItem* { return rotationItem(); }; - d.setCurrentIndex = [=](int current) { + d.currentIndexSetter = [=](int current) { if (auto item = getItem(T_TRANSFORMATION)) model()->removeItem(item); if (current > 0) createTransformationItem()->setRotationType(map[current].second); }; - d.currentIndex = [=]() { + d.currentIndexGetter = [=]() { auto item = rotationItem(); if (item == nullptr) return 0; diff --git a/GUI/Models/ParticleLayoutItem.cpp b/GUI/Models/ParticleLayoutItem.cpp index b1babb1589cb61854e05c6761b1900698e28e4ff..de0d5f97debdf16120859dc7acda84c523cd5621 100644 --- a/GUI/Models/ParticleLayoutItem.cpp +++ b/GUI/Models/ParticleLayoutItem.cpp @@ -129,7 +129,7 @@ SelectionDescriptor<InterferenceItem*> ParticleLayoutItem::interference() const d.currentItem = [=] { return dynamic_cast<InterferenceItem*>(getItem(T_INTERFERENCE)); }; - d.setCurrentIndex = [=](int current) { + d.currentIndexSetter = [=](int current) { if (auto item = getItem(T_INTERFERENCE)) model()->removeItem(item); if (current > 0) @@ -137,7 +137,7 @@ SelectionDescriptor<InterferenceItem*> ParticleLayoutItem::interference() const T_INTERFERENCE); }; - d.currentIndex = [=]() { + d.currentIndexGetter = [=]() { if (auto item = dynamic_cast<InterferenceItem*>(getItem(T_INTERFERENCE))) for (int i = 1; i < map.size(); i++) if (map[i].second == item->modelType()) diff --git a/GUI/Views/SampleDesigner/SampleEditorController.cpp b/GUI/Views/SampleDesigner/SampleEditorController.cpp index 1f281a688b8a9e2ede55d66067184d156e86fe17..d54b91813484626017c17cb33f30e961da666b98 100644 --- a/GUI/Views/SampleDesigner/SampleEditorController.cpp +++ b/GUI/Views/SampleDesigner/SampleEditorController.cpp @@ -226,6 +226,11 @@ void SampleEditorController::setInt(int newValue, UIntDescriptor d) d.set(newValue); } +void SampleEditorController::setCurrentIndex(int index, const AbstractSelectionDescriptor& d) +{ + d.setCurrentIndex(index); +} + QUndoStack* SampleEditorController::undoStack() { return &m_undoStack; diff --git a/GUI/Views/SampleDesigner/SampleEditorController.h b/GUI/Views/SampleDesigner/SampleEditorController.h index 8cc63bb025f9c2e2d1b1abeba6efdf0b5384df9b..838b0ac34a0ad551a629d6c3a3c800c63735a8db 100644 --- a/GUI/Views/SampleDesigner/SampleEditorController.h +++ b/GUI/Views/SampleDesigner/SampleEditorController.h @@ -29,6 +29,7 @@ class ParticleCompositionItem; class DoubleDescriptor; class UIntDescriptor; class ItemWithMaterial; +class AbstractSelectionDescriptor; //! Class to modify a sample from the layer oriented sample editor. //! @@ -72,11 +73,7 @@ public: void setDoubleFromUndo(double newValue, const QString& path); void setInt(int newValue, UIntDescriptor d); - template <typename SelectionDescriptorClass> - void setCurrentIndex(int index, SelectionDescriptorClass d) - { - d.setCurrentIndex(index); - } + void setCurrentIndex(int index, const AbstractSelectionDescriptor& d); void selectMaterial(ItemWithMaterial* item, const QString& newMaterialIdentifier); void setMaterialValue(ItemWithMaterial* item, double newValue, DoubleDescriptor d);