Skip to content
Snippets Groups Projects
Commit 6a36413a authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

[m.sigma] Repair LayerForm appearance ()

Merging branch 'm.sigma'  into 'main'.

See merge request !2277
parents 590e3d60 37acc37d
No related branches found
No related tags found
1 merge request!2277Repair LayerForm appearance
Pipeline #125640 passed
......@@ -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.",
......
......@@ -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)
......
......@@ -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();
}
......
......@@ -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) {
......
......@@ -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.
......
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