diff --git a/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp b/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp index 0097f0ebd14a4fc47e875fb798c531a3ca21be61..76106f945298d98562a9f96e3c5f4b985933a64c 100644 --- a/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp +++ b/GUI/View/SampleDesigner/ParticleCoreShellForm.cpp @@ -76,6 +76,13 @@ ParticleCoreShellForm::ParticleCoreShellForm(QWidget* parent, ParticleCoreShellI &ParticleCoreShellForm::onCoreComboChanged); core.layouter->addRow("Form factor:", core.formFactorCombo); core.collapser = GroupBoxCollapser::installIntoGroupBox(coreParticleGroup); + + auto* showInRealSpaceAction = + ActionFactory::createShowInRealSpaceAction(this, "core particle"); + connect(showInRealSpaceAction, &QAction::triggered, this, + &ParticleCoreShellForm::showCoreInRealSpace); + core.collapser->addAction(showInRealSpaceAction); + createCoreWidgets(); layouter.addRow(coreParticleGroup); @@ -92,6 +99,13 @@ ParticleCoreShellForm::ParticleCoreShellForm(QWidget* parent, ParticleCoreShellI &ParticleCoreShellForm::onShellComboChanged); shell.layouter->addRow("Form factor:", shell.formFactorCombo); shell.collapser = GroupBoxCollapser::installIntoGroupBox(shellParticleGroup); + + auto* showInRealSpaceAction = + ActionFactory::createShowInRealSpaceAction(this, "shell particle"); + connect(showInRealSpaceAction, &QAction::triggered, this, + &ParticleCoreShellForm::showShellInRealSpace); + shell.collapser->addAction(showInRealSpaceAction); + createShellWidgets(); layouter.addRow(shellParticleGroup); @@ -99,6 +113,11 @@ ParticleCoreShellForm::ParticleCoreShellForm(QWidget* parent, ParticleCoreShellI auto* mainCollapser = GroupBoxCollapser::installIntoGroupBox(this); + auto* showInRealSpaceAction = ActionFactory::createShowInRealSpaceAction( + this, "core/shell particle", [=] { ec->requestViewInRealSpace(item); }); + + mainCollapser->addAction(showInRealSpaceAction); + if (allowRemove) { m_removeAction = ActionFactory::createRemoveAction(this, "core/shell particle", [=] { ec->removeParticle(item); }); @@ -106,7 +125,6 @@ ParticleCoreShellForm::ParticleCoreShellForm(QWidget* parent, ParticleCoreShellI } } - void ParticleCoreShellForm::onCoreComboChanged() { while (core.layouter->layout()->rowCount() > 1) @@ -125,6 +143,18 @@ void ParticleCoreShellForm::onShellComboChanged() m_ec->setShellFormFactor(this, newClassName); } +void ParticleCoreShellForm::showCoreInRealSpace() +{ + if (ParticleItem* particle = dynamic_cast<ParticleItem*>(m_item->core())) + m_ec->requestViewInRealSpace(particle); +} + +void ParticleCoreShellForm::showShellInRealSpace() +{ + if (ParticleItem* particle = dynamic_cast<ParticleItem*>(m_item->shell())) + m_ec->requestViewInRealSpace(particle); +} + void ParticleCoreShellForm::createCoreWidgets() { QString groupTitle = "Core"; diff --git a/GUI/View/SampleDesigner/ParticleCoreShellForm.h b/GUI/View/SampleDesigner/ParticleCoreShellForm.h index bacd010e92babd0894b5895ea0a891863a576bdb..5df4fc9600de230d113623c72b407bc08f5405af 100644 --- a/GUI/View/SampleDesigner/ParticleCoreShellForm.h +++ b/GUI/View/SampleDesigner/ParticleCoreShellForm.h @@ -41,6 +41,9 @@ private: void onCoreComboChanged(); void onShellComboChanged(); + void showCoreInRealSpace(); + void showShellInRealSpace(); + private: ParticleCoreShellItem* m_item; QAction* m_removeAction = nullptr;