diff --git a/GUI/Model/Sample/CoreAndShellItem.h b/GUI/Model/Sample/CoreAndShellItem.h index eaa949b6c0a3730c083d9db6708ce95835f7e0db..a6368de15ab13b526daf399150e07ba9df45bc66 100644 --- a/GUI/Model/Sample/CoreAndShellItem.h +++ b/GUI/Model/Sample/CoreAndShellItem.h @@ -42,14 +42,6 @@ public: bool expandMain = true; bool expandCore = true; bool expandShell = true; - bool isExpandMain() const { return expandMain; } - void setExpandMain(bool b) { expandMain = b; } - - bool isExpandCore() const { return expandCore; } - void setExpandCore(bool b) { expandCore = b; } - - bool isExpandShell() const { return expandShell; } - void setExpandShell(bool b) { expandShell = b; } private: std::unique_ptr<ParticleItem> m_core; diff --git a/GUI/View/SampleDesigner/CoreAndShellForm.cpp b/GUI/View/SampleDesigner/CoreAndShellForm.cpp index e44f7108fcfcd4592311674dbdfc86e7209d13e0..ef171b82d6c443bfb8fba4ec040472e909423cd3 100644 --- a/GUI/View/SampleDesigner/CoreAndShellForm.cpp +++ b/GUI/View/SampleDesigner/CoreAndShellForm.cpp @@ -76,16 +76,14 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI connect(core.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CoreAndShellForm::onCoreComboChanged); core.layouter->addRow("Form factor:", core.formfactorCombo); - core.collapser = GroupBoxCollapser::installIntoGroupBox(coreParticleGroup); + core.collapser = GroupBoxCollapser::installIntoGroupBox(coreParticleGroup, + coreShellItem->expandCore); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction(this, "core particle"); connect(showInRealspaceAction, &QAction::triggered, this, &CoreAndShellForm::showCoreInRealspace); core.collapser->addTitleAction(showInRealspaceAction); - core.collapser->setExpanded(coreShellItem->isExpandCore()); - connect(core.collapser, &GroupBoxCollapser::toggled, this, - [coreShellItem](bool b) { coreShellItem->setExpandCore(b); }); createCoreWidgets(); @@ -104,10 +102,7 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI connect(shell.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CoreAndShellForm::onShellComboChanged); shell.layouter->addRow("Form factor:", shell.formfactorCombo); - shell.collapser = GroupBoxCollapser::installIntoGroupBox(shellParticleGroup); - shell.collapser->setExpanded(coreShellItem->isExpandShell()); - connect(shell.collapser, &GroupBoxCollapser::toggled, this, - [coreShellItem](bool b) { coreShellItem->setExpandShell(b); }); + GroupBoxCollapser::installIntoGroupBox(shellParticleGroup, coreShellItem->expandShell); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction(this, "shell particle"); @@ -120,10 +115,7 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI layouter.addRow(shellParticleGroup); } - auto* mainCollapser = GroupBoxCollapser::installIntoGroupBox(this); - mainCollapser->setExpanded(coreShellItem->isExpandMain()); - connect(mainCollapser, &GroupBoxCollapser::toggled, this, - [coreShellItem](bool b) { coreShellItem->setExpandMain(b); }); + auto* mainCollapser = GroupBoxCollapser::installIntoGroupBox(this, coreShellItem->expandMain); // top right corner actions // show in real space