diff --git a/GUI/Model/Sample/CompoundItem.cpp b/GUI/Model/Sample/CompoundItem.cpp index 62b887fa4c23e16ee51ee74e234beaf949331e44..7fa45c9b4cce955606c2b38b2c1b9b8bf12da39f 100644 --- a/GUI/Model/Sample/CompoundItem.cpp +++ b/GUI/Model/Sample/CompoundItem.cpp @@ -27,6 +27,7 @@ namespace Tag { const QString Particle("Particle"); const QString BaseData("BaseData"); +const QString ExpandCompoundGroupbox("ExpandCompoundGroupbox"); } // namespace Tag @@ -61,6 +62,11 @@ void CompoundItem::writeTo(QXmlStreamWriter* w) const sel.writeTo(w); w->writeEndElement(); } + + // compound groupbox: is expanded? + w->writeStartElement(Tag::ExpandCompoundGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandCompound); + w->writeEndElement(); } void CompoundItem::readFrom(QXmlStreamReader* r) @@ -83,6 +89,11 @@ void CompoundItem::readFrom(QXmlStreamReader* r) addItemWithParticleSelection(nullptr).readFrom(r, m_materialModel); XML::gotoEndElementOfTag(r, tag); + // compound groupbox: is expanded? + } else if (tag == Tag::ExpandCompoundGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandCompound); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/CompoundItem.h b/GUI/Model/Sample/CompoundItem.h index e194ccb6252d454b211504ed695b42a7e68a5fde..a2e2eafd637746d1ff7826deb663dcf2442eca13 100644 --- a/GUI/Model/Sample/CompoundItem.h +++ b/GUI/Model/Sample/CompoundItem.h @@ -38,9 +38,13 @@ public: QVector<ItemWithParticles*> containedItemsWithParticles() const override; + bool isExpandCompound() const { return m_expandCompound; } + void setExpandCompound(bool b) { m_expandCompound = b; } + private: std::vector<SelectionProperty<ItemWithParticlesCatalog>> m_particleSelections; const MaterialModel* m_materialModel; + bool m_expandCompound = true; }; #endif // BORNAGAIN_GUI_MODEL_SAMPLE_COMPOUNDITEM_H diff --git a/GUI/Model/Sample/CoreAndShellItem.cpp b/GUI/Model/Sample/CoreAndShellItem.cpp index 17587af64266a7dfd750b528515ee6fcfdd35f5e..dbd512cd702d509f979f435d080e566ce139315e 100644 --- a/GUI/Model/Sample/CoreAndShellItem.cpp +++ b/GUI/Model/Sample/CoreAndShellItem.cpp @@ -27,6 +27,9 @@ namespace Tag { const QString Core("Core"); const QString Shell("Shell"); const QString BaseData("BaseData"); +const QString ExpandMainGroupbox("ExpandMainGroupbox"); +const QString ExpandCoreGroupbox("ExpandCoreGroupbox"); +const QString ExpandShellGroupbox("ExpandShellGroupbox"); } // namespace Tag @@ -66,6 +69,21 @@ void CoreAndShellItem::writeTo(QXmlStreamWriter* w) const m_shell->writeTo(w); w->writeEndElement(); } + + // main groupbox: is expanded? + w->writeStartElement(Tag::ExpandMainGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandMain); + w->writeEndElement(); + + // core groupbox: is expanded? + w->writeStartElement(Tag::ExpandCoreGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandCore); + w->writeEndElement(); + + // shell groupbox: is expanded? + w->writeStartElement(Tag::ExpandShellGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandShell); + w->writeEndElement(); } void CoreAndShellItem::readFrom(QXmlStreamReader* r) @@ -91,6 +109,21 @@ void CoreAndShellItem::readFrom(QXmlStreamReader* r) createShellItem(m_materialModel)->readFrom(r); XML::gotoEndElementOfTag(r, tag); + // main groupbox: is expanded? + } else if (tag == Tag::ExpandMainGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandMain); + XML::gotoEndElementOfTag(r, tag); + + // core groupbox: is expanded? + } else if (tag == Tag::ExpandCoreGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandCore); + XML::gotoEndElementOfTag(r, tag); + + // shell groupbox: is expanded? + } else if (tag == Tag::ExpandShellGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandShell); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/CoreAndShellItem.h b/GUI/Model/Sample/CoreAndShellItem.h index 1893f525f76195b46a3d6da1dd3747574d056146..625d96772b6c7a461ee44c07365a1a957f3a61bc 100644 --- a/GUI/Model/Sample/CoreAndShellItem.h +++ b/GUI/Model/Sample/CoreAndShellItem.h @@ -39,10 +39,22 @@ public: QVector<ItemWithParticles*> containedItemsWithParticles() const override; + bool isExpandMain() const { return m_expandMain; } + void setExpandMain(bool b) { m_expandMain = b; } + + bool isExpandCore() const { return m_expandCore; } + void setExpandCore(bool b) { m_expandCore = b; } + + bool isExpandShell() const { return m_expandShell; } + void setExpandShell(bool b) { m_expandShell = b; } + private: std::unique_ptr<ParticleItem> m_core; std::unique_ptr<ParticleItem> m_shell; const MaterialModel* m_materialModel; + bool m_expandMain = true; + bool m_expandCore = true; + bool m_expandShell = true; }; #endif // BORNAGAIN_GUI_MODEL_SAMPLE_COREANDSHELLITEM_H diff --git a/GUI/Model/Sample/LayerItem.cpp b/GUI/Model/Sample/LayerItem.cpp index 03850e6effa6f88e9404d7a082274eac99bbef6f..5233af8c962646f42ec0f5261c91d989e38129ae 100644 --- a/GUI/Model/Sample/LayerItem.cpp +++ b/GUI/Model/Sample/LayerItem.cpp @@ -33,6 +33,7 @@ const QString NumSlices("NumSlices"); const QString Thickness("Thickness"); const QString Roughness("Roughness"); const QString Layout("Layout"); +const QString ExpandLayerGroupbox("ExpandLayerGroupbox"); } // namespace Tag @@ -161,6 +162,11 @@ void LayerItem::writeTo(QXmlStreamWriter* w) const layout->writeTo(w); w->writeEndElement(); } + + // layer groupbox: is expanded? + w->writeStartElement(Tag::ExpandLayerGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandLayer); + w->writeEndElement(); } void LayerItem::readFrom(QXmlStreamReader* r) @@ -208,6 +214,11 @@ void LayerItem::readFrom(QXmlStreamReader* r) addLayoutItem()->readFrom(r); XML::gotoEndElementOfTag(r, tag); + // layer groupbox: is expanded? + } else if (tag == Tag::ExpandLayerGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandLayer); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/LayerItem.h b/GUI/Model/Sample/LayerItem.h index d5683c8b33de968c9e18937daf9f29ed52de05bd..d2d91a8466554e2c7b1f6a4c668dfebc4f661dfd 100644 --- a/GUI/Model/Sample/LayerItem.h +++ b/GUI/Model/Sample/LayerItem.h @@ -65,6 +65,9 @@ public: void writeTo(QXmlStreamWriter* w) const; void readFrom(QXmlStreamReader* r); + bool isExpandLayer() const { return m_expandLayer; } + void setExpandLayer(bool b) { m_expandLayer = b; } + private: QString m_name; uint m_numSlices = 1; @@ -74,6 +77,7 @@ private: bool m_isBottomLayer = false; OwningVector<ParticleLayoutItem> m_layouts; SelectionProperty<RoughnessItemCatalog> m_roughness; + bool m_expandLayer = false; }; #endif // BORNAGAIN_GUI_MODEL_SAMPLE_LAYERITEM_H diff --git a/GUI/Model/Sample/MesocrystalItem.cpp b/GUI/Model/Sample/MesocrystalItem.cpp index 44b37d1ea9d53a44f89adbce5451690e4fbb8f7f..8c3849bcafb706eb37f8f02e17013ef8dc0023b0 100644 --- a/GUI/Model/Sample/MesocrystalItem.cpp +++ b/GUI/Model/Sample/MesocrystalItem.cpp @@ -35,6 +35,7 @@ const QString VectorC("VectorC"); const QString OuterShape("OuterShape"); const QString BasisParticle("BasisParticle"); const QString BaseData("BaseData"); +const QString ExpandMesocrystalGroupbox("ExpandMesocrystalGroupbox"); } // namespace Tag @@ -94,6 +95,11 @@ void MesocrystalItem::writeTo(QXmlStreamWriter* w) const w->writeStartElement(Tag::BasisParticle); m_basisParticle.writeTo(w); w->writeEndElement(); + + // mesocrystal groupbox: is expanded? + w->writeStartElement(Tag::ExpandMesocrystalGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandMesocrystal); + w->writeEndElement(); } void MesocrystalItem::readFrom(QXmlStreamReader* r) @@ -134,6 +140,11 @@ void MesocrystalItem::readFrom(QXmlStreamReader* r) m_basisParticle.readFrom(r, m_materialModel); XML::gotoEndElementOfTag(r, tag); + // mesocrystal groupbox: is expanded? + } else if (tag == Tag::ExpandMesocrystalGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandMesocrystal); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/MesocrystalItem.h b/GUI/Model/Sample/MesocrystalItem.h index e90202153098897e9892f6ee012b8e994ed11e16..523b73b7fd13c267e231c8222fc0471812afce2b 100644 --- a/GUI/Model/Sample/MesocrystalItem.h +++ b/GUI/Model/Sample/MesocrystalItem.h @@ -65,6 +65,9 @@ public: QVector<ItemWithParticles*> containedItemsWithParticles() const override; + bool isExpandMesocrystal() const { return m_expandMesocrystal; } + void setExpandMesocrystal(bool b) { m_expandMesocrystal = b; } + private: VectorProperty m_vectorA; VectorProperty m_vectorB; @@ -72,6 +75,7 @@ private: SelectionProperty<FormFactorItemCatalog> m_outerShape; SelectionProperty<ItemWithParticlesCatalog> m_basisParticle; const MaterialModel* m_materialModel; + bool m_expandMesocrystal = true; }; template <typename T> diff --git a/GUI/Model/Sample/ParticleItem.cpp b/GUI/Model/Sample/ParticleItem.cpp index ae57c1be5453cca33693d96391b90db65ad3f7d8..29f876b0eafb3ab7e530f6c091d4ada5dd27b00a 100644 --- a/GUI/Model/Sample/ParticleItem.cpp +++ b/GUI/Model/Sample/ParticleItem.cpp @@ -26,6 +26,7 @@ namespace Tag { const QString FormFactor("FormFactor"); const QString MaterialData("MaterialData"); const QString BaseData("BaseData"); +const QString ExpandParticleGroupbox("ExpandParticleGroupbox"); } // namespace Tag @@ -63,6 +64,11 @@ void ParticleItem::writeTo(QXmlStreamWriter* w) const w->writeStartElement(Tag::FormFactor); m_formFactor.writeTo(w); w->writeEndElement(); + + // particle groupbox: is expanded? + w->writeStartElement(Tag::ExpandParticleGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandParticle); + w->writeEndElement(); } void ParticleItem::readFrom(QXmlStreamReader* r) @@ -88,6 +94,11 @@ void ParticleItem::readFrom(QXmlStreamReader* r) m_formFactor.readFrom(r); XML::gotoEndElementOfTag(r, tag); + // particle groupbox: is expanded? + } else if (tag == Tag::ExpandParticleGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandParticle); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/ParticleItem.h b/GUI/Model/Sample/ParticleItem.h index cd17eeb16e63d97324598e7bc36a1072b06e8354..6804c4e27ccb9eea73c72638aeb393fa35289cb7 100644 --- a/GUI/Model/Sample/ParticleItem.h +++ b/GUI/Model/Sample/ParticleItem.h @@ -39,8 +39,12 @@ public: FormFactorItem* formFactorItem() const; QVector<ItemWithParticles*> containedItemsWithParticles() const override; + bool isExpandParticle() const { return m_expandParticle; } + void setExpandParticle(bool b) { m_expandParticle = b; } + private: SelectionProperty<FormFactorItemCatalog> m_formFactor; + bool m_expandParticle = true; }; template <typename T> diff --git a/GUI/Model/Sample/ParticleLayoutItem.cpp b/GUI/Model/Sample/ParticleLayoutItem.cpp index 016558ca0f25aa46028295b3d89b5fd3f05370a2..afa63cbabfb8e4f7b9d8ec462be7f8eb7a261db1 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.cpp +++ b/GUI/Model/Sample/ParticleLayoutItem.cpp @@ -26,6 +26,8 @@ namespace Tag { const QString OwnDensity("OwnDensity"); const QString InterferenceFunction("InterferenceFunction"); const QString Particle("Particle"); +const QString ExpandLayoutGroupbox("ExpandLayoutGroupbox"); +const QString ExpandInterferenceGroupbox("ExpandInterferenceGroupbox"); } // namespace Tag } // namespace @@ -131,6 +133,16 @@ void ParticleLayoutItem::writeTo(QXmlStreamWriter* w) const sel.writeTo(w); w->writeEndElement(); } + + // layout groupbox: is expanded? + w->writeStartElement(Tag::ExpandLayoutGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandParticleLayout); + w->writeEndElement(); + + // interference groupbox: is expanded? + w->writeStartElement(Tag::ExpandInterferenceGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandInterference); + w->writeEndElement(); } void ParticleLayoutItem::readFrom(QXmlStreamReader* r) @@ -158,6 +170,16 @@ void ParticleLayoutItem::readFrom(QXmlStreamReader* r) addItemWithParticleSelection(nullptr).readFrom(r, m_materialModel); XML::gotoEndElementOfTag(r, tag); + // layout groupbox: is expanded? + } else if (tag == Tag::ExpandLayoutGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandParticleLayout); + XML::gotoEndElementOfTag(r, tag); + + // interference groupbox: is expanded? + } else if (tag == Tag::ExpandInterferenceGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandInterference); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/ParticleLayoutItem.h b/GUI/Model/Sample/ParticleLayoutItem.h index 1fbaee35051d9740631de8591325b3caf13a50dd..5169719b615209bb8d2fcf2c7333400b6ce8cdb5 100644 --- a/GUI/Model/Sample/ParticleLayoutItem.h +++ b/GUI/Model/Sample/ParticleLayoutItem.h @@ -74,11 +74,19 @@ public: void writeTo(QXmlStreamWriter* w) const; void readFrom(QXmlStreamReader* r); + bool isExpandLayout() const { return m_expandParticleLayout; } + void setExpandLayout(bool b) { m_expandParticleLayout = b; } + + bool isExpandInterference() const { return m_expandInterference; } + void setExpandInterference(bool b) { m_expandInterference = b; } + private: DoubleProperty m_ownDensity; SelectionProperty<InterferenceItemCatalog> m_interference; std::vector<SelectionProperty<ItemWithParticlesCatalog>> m_particles; const MaterialModel* m_materialModel; + bool m_expandParticleLayout = true; + bool m_expandInterference = true; }; #endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLELAYOUTITEM_H diff --git a/GUI/Model/Sample/SampleItem.cpp b/GUI/Model/Sample/SampleItem.cpp index 3ac59463b1f0aca97b970efc0c083f5ae2d693b1..3f0430e51cc6992b01b911e8c66f76bd5186e757 100644 --- a/GUI/Model/Sample/SampleItem.cpp +++ b/GUI/Model/Sample/SampleItem.cpp @@ -27,6 +27,7 @@ const QString CrossCorrelationLength("CrossCorrelationLength"); const QString MaterialModel("MaterialModel"); const QString Layer("Layer"); const QString ExternalField("ExternalField"); +const QString ExpandInfoGroupbox("ExpandInfoGroupbox"); } // namespace Tag } // namespace @@ -144,6 +145,11 @@ void SampleItem::writeTo(QXmlStreamWriter* w) const layer->writeTo(w); w->writeEndElement(); } + + // info groupbox: is expanded? + w->writeStartElement(Tag::ExpandInfoGroupbox); + XML::writeAttribute(w, XML::Attrib::value, m_expandInfo); + w->writeEndElement(); } void SampleItem::readFrom(QXmlStreamReader* r) @@ -186,6 +192,11 @@ void SampleItem::readFrom(QXmlStreamReader* r) createLayerItemAt()->readFrom(r); XML::gotoEndElementOfTag(r, tag); + // info groupbox: is expanded? + } else if (tag == Tag::ExpandInfoGroupbox) { + XML::readAttribute(r, XML::Attrib::value, &m_expandInfo); + XML::gotoEndElementOfTag(r, tag); + } else r->skipCurrentElement(); } diff --git a/GUI/Model/Sample/SampleItem.h b/GUI/Model/Sample/SampleItem.h index 721ee94832965f4fa34cc2144b2214fa964e89c6..6a4fa06514000532588740c9ee43575af5b199ff 100644 --- a/GUI/Model/Sample/SampleItem.h +++ b/GUI/Model/Sample/SampleItem.h @@ -70,6 +70,9 @@ public: MaterialModel& materialModel() { return m_materials; } const MaterialModel& materialModel() const { return m_materials; } + bool isExpandInfo() const { return m_expandInfo; } + void setExpandInfo(bool b) { m_expandInfo = b; } + private: QString m_name; QString m_description; @@ -77,6 +80,7 @@ private: VectorProperty m_externalField; OwningVector<LayerItem> m_layers; MaterialModel m_materials; + bool m_expandInfo = true; }; #endif // BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLEITEM_H diff --git a/GUI/View/Instrument/InstrumentView.cpp b/GUI/View/Instrument/InstrumentView.cpp index 870009b1755823a7641c60913eda6a2e8ad7db06..61e8a1d08b82027332c5614e01d64eb2c2af41ff 100644 --- a/GUI/View/Instrument/InstrumentView.cpp +++ b/GUI/View/Instrument/InstrumentView.cpp @@ -138,6 +138,7 @@ void InstrumentView::createWidgetsForCurrentInstrument() auto* g = new QGroupBox(m_scrollArea); g->setTitle(QString("Information (%1 instrument)").arg(currentInstrument->instrumentType())); + g->setMaximumHeight(200); auto* formLayout = new QFormLayout(g); formLayout->setContentsMargins(17, 17, 17, 17); diff --git a/GUI/View/SampleDesigner/CompoundForm.cpp b/GUI/View/SampleDesigner/CompoundForm.cpp index 09a7cab60044c23b6b59e71cfd3a3947a8be70ef..1e5465cf6f2a4759371f4b6334eba5d1d55a5a02 100644 --- a/GUI/View/SampleDesigner/CompoundForm.cpp +++ b/GUI/View/SampleDesigner/CompoundForm.cpp @@ -48,6 +48,9 @@ CompoundForm::CompoundForm(QWidget* parent, CompoundItem* compositionItem, layouter.addStructureEditingRow(btn); auto* collapser = GroupBoxCollapser::installIntoGroupBox(this); + collapser->setExpanded(compositionItem->isExpandCompound()); + connect(collapser, &GroupBoxCollapser::toggled, this, + [compositionItem](bool b) { compositionItem->setExpandCompound(b); }); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( this, "particle composition", [=] { ec->requestViewInRealspace(compositionItem); }); diff --git a/GUI/View/SampleDesigner/CoreAndShellForm.cpp b/GUI/View/SampleDesigner/CoreAndShellForm.cpp index b01ed4bb1bd23038e2f385c5ceb93c89d4c40033..e37cc6672029925f5080e7f40172128d784c6f6a 100644 --- a/GUI/View/SampleDesigner/CoreAndShellForm.cpp +++ b/GUI/View/SampleDesigner/CoreAndShellForm.cpp @@ -83,6 +83,9 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* item, connect(showInRealspaceAction, &QAction::triggered, this, &CoreAndShellForm::showCoreInRealspace); core.collapser->addAction(showInRealspaceAction); + core.collapser->setExpanded(item->isExpandCore()); + connect(core.collapser, &GroupBoxCollapser::toggled, this, + [item](bool b) { item->setExpandCore(b); }); createCoreWidgets(); @@ -101,6 +104,9 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* item, &CoreAndShellForm::onShellComboChanged); shell.layouter->addRow("Form factor:", shell.formfactorCombo); shell.collapser = GroupBoxCollapser::installIntoGroupBox(shellParticleGroup); + shell.collapser->setExpanded(item->isExpandShell()); + connect(shell.collapser, &GroupBoxCollapser::toggled, this, + [item](bool b) { item->setExpandShell(b); }); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction(this, "shell particle"); @@ -114,6 +120,9 @@ CoreAndShellForm::CoreAndShellForm(QWidget* parent, CoreAndShellItem* item, } auto* mainCollapser = GroupBoxCollapser::installIntoGroupBox(this); + mainCollapser->setExpanded(item->isExpandMain()); + connect(mainCollapser, &GroupBoxCollapser::toggled, this, + [item](bool b) { item->setExpandMain(b); }); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( this, "core/shell particle", [=] { ec->requestViewInRealspace(item); }); diff --git a/GUI/View/SampleDesigner/InterferenceForm.cpp b/GUI/View/SampleDesigner/InterferenceForm.cpp index 3c1f2cf9209634b40e2f60ce09f1e518979a732e..d9446cfdf6ea5a7a37e6c194d066350bad0aa824 100644 --- a/GUI/View/SampleDesigner/InterferenceForm.cpp +++ b/GUI/View/SampleDesigner/InterferenceForm.cpp @@ -35,6 +35,9 @@ InterferenceForm::InterferenceForm(QWidget* parent, ParticleLayoutItem* layoutIt FormLayouter layouter(this, ec); layouter.setContentsMargins(6, 6, 0, 6); m_collapser = GroupBoxCollapser::installIntoGroupBox(this); + m_collapser->setExpanded(layoutItem->isExpandInterference()); + connect(m_collapser, &GroupBoxCollapser::toggled, this, + [layoutItem](bool b) { layoutItem->setExpandInterference(b); }); m_interferenceTypeCombo = new QComboBox(this); WheelEventEater::install(m_interferenceTypeCombo); diff --git a/GUI/View/SampleDesigner/LayerForm.cpp b/GUI/View/SampleDesigner/LayerForm.cpp index e4c5009047b6b1b11c3a0115ffa29383fe602559..8ecb1782e517c16cbfef521e549160e928923ce5 100644 --- a/GUI/View/SampleDesigner/LayerForm.cpp +++ b/GUI/View/SampleDesigner/LayerForm.cpp @@ -37,6 +37,9 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layer, SampleEditorController* m_layouter = std::make_unique<FormLayouter>(this, ec); m_layouter->setContentsMargins(6, 6, 0, 6); m_collapser = GroupBoxCollapser::installIntoGroupBox(this, false); + m_collapser->setExpanded(layer->isExpandLayer()); + connect(m_collapser, &GroupBoxCollapser::toggled, this, + [layer](bool b) { layer->setExpandLayer(b); }); m_removeAction = ActionFactory::createRemoveAction(this, "layer", [=] { ec->removeLayerItem(layer); }); diff --git a/GUI/View/SampleDesigner/MesocrystalForm.cpp b/GUI/View/SampleDesigner/MesocrystalForm.cpp index d0755a2055a7fec95247bff9b882b400b5ce3041..b62b465c83ba99ec1b5d97a43deb36d660d6d31c 100644 --- a/GUI/View/SampleDesigner/MesocrystalForm.cpp +++ b/GUI/View/SampleDesigner/MesocrystalForm.cpp @@ -49,6 +49,9 @@ MesocrystalForm::MesocrystalForm(QWidget* parent, MesocrystalItem* item, SampleE createBasisWidgets(); auto* collapser = GroupBoxCollapser::installIntoGroupBox(this); + collapser->setExpanded(item->isExpandMesocrystal()); + connect(collapser, &GroupBoxCollapser::toggled, this, + [item](bool b) { item->setExpandMesocrystal(b); }); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( this, "meso crystal", [=] { ec->requestViewInRealspace(item); }); diff --git a/GUI/View/SampleDesigner/ParticleForm.cpp b/GUI/View/SampleDesigner/ParticleForm.cpp index 88e8fc77c4837031cb1d9bfda9c6a1e651958cff..143cc7dd1dc3e093b5f888bf953eef5641ed036b 100644 --- a/GUI/View/SampleDesigner/ParticleForm.cpp +++ b/GUI/View/SampleDesigner/ParticleForm.cpp @@ -38,6 +38,9 @@ ParticleForm::ParticleForm(QWidget* parent, ParticleItem* particleItem, bool all layouter.addValue(particleItem->abundance()); auto* collapser = GroupBoxCollapser::installIntoGroupBox(this); + collapser->setExpanded(particleItem->isExpandParticle()); + connect(collapser, &GroupBoxCollapser::toggled, this, + [particleItem](bool b) { particleItem->setExpandParticle(b); }); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( this, "particle", [=] { ec->requestViewInRealspace(particleItem); }); diff --git a/GUI/View/SampleDesigner/ParticleLayoutForm.cpp b/GUI/View/SampleDesigner/ParticleLayoutForm.cpp index 56e10d477d968159f4d39b0ea4c8d4ecb0177da1..89af10cf1f50ceb874b78ff6875d9435e905b297 100644 --- a/GUI/View/SampleDesigner/ParticleLayoutForm.cpp +++ b/GUI/View/SampleDesigner/ParticleLayoutForm.cpp @@ -60,6 +60,10 @@ ParticleLayoutForm::ParticleLayoutForm(LayerForm* parent, ParticleLayoutItem* la this, "particle layout", [=] { ec->requestViewInRealspace(layoutItem); }); m_collapser = GroupBoxCollapser::installIntoGroupBox(this); + m_collapser->setExpanded(layoutItem->isExpandLayout()); + connect(m_collapser, &GroupBoxCollapser::toggled, this, + [layoutItem](bool b) { layoutItem->setExpandLayout(b); }); + m_collapser->addAction(showInRealspaceAction); m_collapser->addAction(m_removeAction); m_layout = layouter.layout(); diff --git a/GUI/View/SampleDesigner/SampleForm.cpp b/GUI/View/SampleDesigner/SampleForm.cpp index 9ddc7bb6e0aeeb743b9b4be429efd84a6989df57..d0b3e99b5e96d6cc7bd4945bf51e43187f9230b0 100644 --- a/GUI/View/SampleDesigner/SampleForm.cpp +++ b/GUI/View/SampleDesigner/SampleForm.cpp @@ -73,10 +73,11 @@ SampleForm::SampleForm(QWidget* parent, SampleItem* sampleItem, SampleEditorCont auto* nameEdit = new QLineEdit(props); layouter.addRow("Name:", nameEdit); nameEdit->setText(sampleItem->sampleName()); + nameEdit->setFixedWidth(585); connect(nameEdit, &QLineEdit::textEdited, ec, &SampleEditorController::setSampleName); auto* descriptionEdit = new QTextEdit(props); - descriptionEdit->setMinimumWidth(300); + descriptionEdit->setFixedWidth(585); descriptionEdit->setMaximumHeight(100); descriptionEdit->setAcceptRichText(false); descriptionEdit->setTabChangesFocus(true); @@ -88,6 +89,9 @@ SampleForm::SampleForm(QWidget* parent, SampleItem* sampleItem, SampleEditorCont layouter.addValue(sampleItem->crossCorrLength()); layouter.addVector(sampleItem->externalField(), false); auto* collapser = GroupBoxCollapser::installIntoGroupBox(props, false); + collapser->setExpanded(sampleItem->isExpandInfo()); + connect(collapser, &GroupBoxCollapser::toggled, this, + [sampleItem](bool b) { sampleItem->setExpandInfo(b); }); auto* showInRealspaceAction = ActionFactory::createShowInRealspaceAction( this, "sample", [=] { m_ec->requestViewInRealspace(m_sampleItem); });