diff --git a/GUI/View/SampleDesigner/MesocrystalForm.cpp b/GUI/View/SampleDesigner/MesocrystalForm.cpp index 0cc94fd9f0cb7f0498dea1168217f4f1e02927e9..ff1e3fb1e7f44413b90c5790a37e2270578b2259 100644 --- a/GUI/View/SampleDesigner/MesocrystalForm.cpp +++ b/GUI/View/SampleDesigner/MesocrystalForm.cpp @@ -53,14 +53,25 @@ MesocrystalForm::MesocrystalForm(QWidget* parent, MesocrystalItem* item, SampleE connect(collapser, &GroupBoxCollapser::toggled, this, [item](bool b) { item->setExpandMesocrystal(b); }); - auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( - this, "meso crystal", [=] { ec->requestViewInRealspace(item); }); - collapser->addAction(showInRealspaceAction); - - if (allowRemove) { - m_removeAction = ActionFactory::createRemoveAction(this, "meso crystal", - [=] { ec->removeParticle(item); }); - collapser->addAction(m_removeAction); + // top right corner actions + // show in real space + { + auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( + this, "meso crystal", [ec, item] { ec->requestViewInRealspace(item); }); + collapser->addAction(showInRealspaceAction); + } + // duplicate + { + m_duplicateAction = ActionFactory::createDuplicateAction( + this, "meso crystal", [ec, item] { ec->duplicateItemWithParticles(item); }); + collapser->addAction(m_duplicateAction); + } + // remove + { + m_removeAction = ActionFactory::createRemoveAction( + this, "meso crystal", [ec, item] { ec->removeParticle(item); }); + if (allowRemove) + collapser->addAction(m_removeAction); } } @@ -118,8 +129,8 @@ void MesocrystalForm::createBasisWidgets() void MesocrystalForm::enableStructureEditing(bool b) { - if (m_removeAction) - m_removeAction->setVisible(b); + m_removeAction->setVisible(b); + m_duplicateAction->setVisible(b); } MesocrystalItem* MesocrystalForm::mesocrystalItem() const diff --git a/GUI/View/SampleDesigner/MesocrystalForm.h b/GUI/View/SampleDesigner/MesocrystalForm.h index 09bec9aa5d06cbc8e78379552e10334b18dc830e..d51d13729344d523ab048d84f25dfc5ec42256b1 100644 --- a/GUI/View/SampleDesigner/MesocrystalForm.h +++ b/GUI/View/SampleDesigner/MesocrystalForm.h @@ -42,6 +42,7 @@ private: QFormLayout* m_layout; MesocrystalItem* m_item; QAction* m_removeAction = nullptr; + QAction* m_duplicateAction = nullptr; SampleEditorController* m_ec; QComboBox* m_basisCombo; int m_rowOfBasisTypeCombo;