diff --git a/GUI/Model/Sample/RoughnessItems.cpp b/GUI/Model/Sample/RoughnessItems.cpp index c9a99f83fafa3223dbe9ebc829ce6eb1ef6516d0..f7300149459e7840347f6096c677e9ec5807d9c9 100644 --- a/GUI/Model/Sample/RoughnessItems.cpp +++ b/GUI/Model/Sample/RoughnessItems.cpp @@ -27,7 +27,7 @@ const QString LateralCorrelationLength("LateralCorrelationLength"); BasicRoughnessItem::BasicRoughnessItem() { - m_sigma.init("Sigma (nm)", "rms of the roughness", 1.0, "sigma"); + m_sigma.init("Sigma (nm)", "rms of the roughness", 0.0, "sigma"); m_hurst.init("Hurst", "Hurst parameter which describes how jagged the interface,\n " "dimensionless [0.0, 1.0], where 0.0 gives more spikes, \n1.0 more smoothness.", diff --git a/GUI/View/Sample/LayerForm.cpp b/GUI/View/Sample/LayerForm.cpp index 81a59111ee763b74a4ce89c1ab6c4381564f5208..fd11d4e359333b68d69396f13bab0b3d53490f5f 100644 --- a/GUI/View/Sample/LayerForm.cpp +++ b/GUI/View/Sample/LayerForm.cpp @@ -32,8 +32,6 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layerItem, SampleEditorControll : CollapsibleGroupBox(layerItem->layerName(), parent, layerItem->expandLayer) , m_layout(new HeinzFormLayout(ec)) , m_layer(layerItem) - , m_thicknessRow(m_layout->rowCount() - 1) - , m_roughnessRow(m_layout->rowCount() - 1) , m_ec(ec) { setContentsMargins(5, 5, 5, 5); @@ -96,6 +94,7 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layerItem, SampleEditorControll m_layout->addBoldRow("Material:", new MaterialInplaceForm(layerItem, ec)); m_layout->addValue(m_layer->thickness()); + m_thicknessRow = m_layout->rowCount() - 1; m_layout->addBoldRow("Number of slices:", GUI::Util::createIntSpinBox( [this] { return m_layer->numSlices(); }, @@ -109,6 +108,7 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layerItem, SampleEditorControll "when corresponding simulation option is set.")); m_layout->addSelection(m_layer->roughnessSelection()); + m_roughnessRow = m_layout->rowCount() - 1; // -- layouts for (auto* layout : layerItem->layoutItems()) @@ -181,8 +181,7 @@ void LayerForm::updateLayerPositionDependentElements() m_layout->insertValue(m_thicknessRow, m_layer->thickness()); } - if (m_ec->sampleItem()->layerItems().size() < 2) - m_moveButton->setVisible(false); + m_moveButton->setVisible(m_ec->sampleItem()->layerItems().size() > 1); } void LayerForm::onLayoutAdded(ParticleLayoutItem* newLayoutItem) diff --git a/GUI/View/Sample/SampleEditorController.cpp b/GUI/View/Sample/SampleEditorController.cpp index 5e09295a31c96f5ad5f81ebdfda61c8818604aa3..4865058e5b3d0a91de7d14d46f8c76874627fb9e 100644 --- a/GUI/View/Sample/SampleEditorController.cpp +++ b/GUI/View/Sample/SampleEditorController.cpp @@ -123,6 +123,7 @@ void SampleEditorController::removeLayerItem(LayerItem* layer) emit aboutToRemoveItem(layer); m_sampleForm->onAboutToRemoveLayer(layer); m_sampleItem->removeLayer(layer); + m_sampleForm->updateRowVisibilities(); emit modified(); } diff --git a/GUI/View/Sample/SampleForm.cpp b/GUI/View/Sample/SampleForm.cpp index 16792484d0b0c97e09e4fe88ff6d408997a4e9c2..b93d12dc2a59d80215c04499350f7e7e4004cd76 100644 --- a/GUI/View/Sample/SampleForm.cpp +++ b/GUI/View/Sample/SampleForm.cpp @@ -117,6 +117,8 @@ void SampleForm::onLayerAdded(LayerItem* layerItem) // same row => button is above! m_layout->insertWidget(rowInLayout, new AddLayerWidget(this, layerItem, m_ec), 0, Qt::AlignTop); + + updateRowVisibilities(); } void SampleForm::onLayerMoved(LayerItem* layerItem) @@ -148,6 +150,8 @@ void SampleForm::onLayerMoved(LayerItem* layerItem) // same row => button is above! m_layout->insertWidget(rowInLayout, al, 0, Qt::AlignTop); + + updateRowVisibilities(); } void SampleForm::onAboutToRemoveLayer(LayerItem* layerItem) @@ -176,6 +180,13 @@ void SampleForm::onAboutToRemoveLayer(LayerItem* layerItem) delete addLayerWidget; } +void SampleForm::updateRowVisibilities() +{ + for (auto* c : findChildren<LayerForm*>()) { + c->updateLayerPositionDependentElements(); + } +} + LayerForm* SampleForm::findNextLayerForm(QWidget* w) { while (w != nullptr && dynamic_cast<LayerForm*>(w) == nullptr) { diff --git a/GUI/View/Sample/SampleForm.h b/GUI/View/Sample/SampleForm.h index c89c76216f9392876bde2c2c52f213120b35faa1..2a1f0483642f20967ec019cb5ce36f941fb83553 100644 --- a/GUI/View/Sample/SampleForm.h +++ b/GUI/View/Sample/SampleForm.h @@ -44,6 +44,8 @@ public: //! Any widgets related to the item will be deleted or scheduled for later deletion. void onAboutToRemoveLayer(LayerItem* layerItem); + void updateRowVisibilities(); + //! Search for the next LayerForm, starting from the given widget. //! //! The search starts with the given widget itself If it is a LayerForm, it is returned.