From cb87cffc4cc1ec00a7b0fab4afd8dc6d435eb5ef Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 27 Oct 2023 17:32:08 +0200 Subject: [PATCH] GroupBoxCollapser::installIntoGroupBox2 used with core&shell --- GUI/Model/Sample/CoreAndShellItem.h | 8 -------- GUI/View/SampleDesigner/CoreAndShellForm.cpp | 16 ++++------------ 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/GUI/Model/Sample/CoreAndShellItem.h b/GUI/Model/Sample/CoreAndShellItem.h index eaa949b6c0a..a6368de15ab 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 e44f7108fcf..ef171b82d6c 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 -- GitLab