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:
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;
......
......@@ -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
......
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