Skip to content
Snippets Groups Projects
Commit cb87cffc authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

GroupBoxCollapser::installIntoGroupBox2 used with core&shell

parent 1af651a5
No related branches found
No related tags found
1 merge request!2062simplify code for collapsible groupboxes; make instrument view more compact
...@@ -42,14 +42,6 @@ public: ...@@ -42,14 +42,6 @@ public:
bool expandMain = true; bool expandMain = true;
bool expandCore = true; bool expandCore = true;
bool expandShell = 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: private:
std::unique_ptr<ParticleItem> m_core; std::unique_ptr<ParticleItem> m_core;
......
...@@ -76,16 +76,14 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI ...@@ -76,16 +76,14 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI
connect(core.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(core.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&CoreAndShellForm::onCoreComboChanged); &CoreAndShellForm::onCoreComboChanged);
core.layouter->addRow("Form factor:", core.formfactorCombo); core.layouter->addRow("Form factor:", core.formfactorCombo);
core.collapser = GroupBoxCollapser::installIntoGroupBox(coreParticleGroup); core.collapser = GroupBoxCollapser::installIntoGroupBox(coreParticleGroup,
coreShellItem->expandCore);
auto* showInRealspaceAction = auto* showInRealspaceAction =
ActionFactory::createShowInRealspaceAction(this, "core particle"); ActionFactory::createShowInRealspaceAction(this, "core particle");
connect(showInRealspaceAction, &QAction::triggered, this, connect(showInRealspaceAction, &QAction::triggered, this,
&CoreAndShellForm::showCoreInRealspace); &CoreAndShellForm::showCoreInRealspace);
core.collapser->addTitleAction(showInRealspaceAction); core.collapser->addTitleAction(showInRealspaceAction);
core.collapser->setExpanded(coreShellItem->isExpandCore());
connect(core.collapser, &GroupBoxCollapser::toggled, this,
[coreShellItem](bool b) { coreShellItem->setExpandCore(b); });
createCoreWidgets(); createCoreWidgets();
...@@ -104,10 +102,7 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI ...@@ -104,10 +102,7 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI
connect(shell.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(shell.formfactorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&CoreAndShellForm::onShellComboChanged); &CoreAndShellForm::onShellComboChanged);
shell.layouter->addRow("Form factor:", shell.formfactorCombo); shell.layouter->addRow("Form factor:", shell.formfactorCombo);
shell.collapser = GroupBoxCollapser::installIntoGroupBox(shellParticleGroup); GroupBoxCollapser::installIntoGroupBox(shellParticleGroup, coreShellItem->expandShell);
shell.collapser->setExpanded(coreShellItem->isExpandShell());
connect(shell.collapser, &GroupBoxCollapser::toggled, this,
[coreShellItem](bool b) { coreShellItem->setExpandShell(b); });
auto* showInRealspaceAction = auto* showInRealspaceAction =
ActionFactory::createShowInRealspaceAction(this, "shell particle"); ActionFactory::createShowInRealspaceAction(this, "shell particle");
...@@ -120,10 +115,7 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI ...@@ -120,10 +115,7 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* coreShellI
layouter.addRow(shellParticleGroup); layouter.addRow(shellParticleGroup);
} }
auto* mainCollapser = GroupBoxCollapser::installIntoGroupBox(this); auto* mainCollapser = GroupBoxCollapser::installIntoGroupBox(this, coreShellItem->expandMain);
mainCollapser->setExpanded(coreShellItem->isExpandMain());
connect(mainCollapser, &GroupBoxCollapser::toggled, this,
[coreShellItem](bool b) { coreShellItem->setExpandMain(b); });
// top right corner actions // top right corner actions
// show in real space // show in real space
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment