Skip to content
Snippets Groups Projects
Commit 82f8d3b6 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

if only one layer -> thickness is "infinite", not "semi-infinite"

parent 78b712f1
No related branches found
No related tags found
1 merge request!428If only one layer -> thickness is "infinite", not "semi-infinite"
Pipeline #48832 passed
...@@ -119,20 +119,27 @@ void LayerForm::updateLayerPositionDependentElements() ...@@ -119,20 +119,27 @@ void LayerForm::updateLayerPositionDependentElements()
const auto* multiLayer = dynamic_cast<MultiLayerItem*>(m_layer->parent()); const auto* multiLayer = dynamic_cast<MultiLayerItem*>(m_layer->parent());
const bool isFirstLayer = multiLayer->layers().first() == m_layer; const bool isFirstLayer = multiLayer->layers().first() == m_layer;
const bool isLastLayer = multiLayer->layers().last() == m_layer; const bool isLastLayer = multiLayer->layers().last() == m_layer;
const bool thicknessIsSemiInfinite = isFirstLayer || isLastLayer; const bool thicknessIsSemiInfinite =
(isFirstLayer || isLastLayer) && (multiLayer->layers().size() != 1);
const bool thicknessIsInfinite = multiLayer->layers().size() == 1;
m_layouter->setRowVisible(m_roughnessRow, !isFirstLayer); m_layouter->setRowVisible(m_roughnessRow, !isFirstLayer);
if (m_thicknessRow == -1) if (m_thicknessRow == -1)
return; return;
QWidget* w = m_layouter->layout()->itemAt(m_thicknessRow, QFormLayout::FieldRole)->widget(); QWidget* w = m_layouter->layout()->itemAt(m_thicknessRow, QFormLayout::FieldRole)->widget();
if (thicknessIsSemiInfinite && (qobject_cast<QLineEdit*>(w) == nullptr)) { if (thicknessIsSemiInfinite || thicknessIsInfinite) {
m_layouter->removeRow(m_thicknessRow); QLineEdit* info = qobject_cast<QLineEdit*>(w);
QLineEdit* info = new QLineEdit("Semi-infinite", this); if (info == nullptr) {
info->setEnabled(false); m_layouter->removeRow(m_thicknessRow);
info->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); info = new QLineEdit(this);
m_layouter->insertRow(m_thicknessRow, m_layer->thickness().label, info); info->setEnabled(false);
} else if (!thicknessIsSemiInfinite && (qobject_cast<QLineEdit*>(w) != nullptr)) { info->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_layouter->insertRow(m_thicknessRow, m_layer->thickness().label, info);
}
info->setText(thicknessIsSemiInfinite ? "Semi-infinite" : "Infinite");
} else if (!thicknessIsSemiInfinite && !thicknessIsInfinite
&& (qobject_cast<QLineEdit*>(w) != nullptr)) {
m_layouter->removeRow(m_thicknessRow); m_layouter->removeRow(m_thicknessRow);
m_layouter->insertValue(m_thicknessRow, m_layer->thickness()); m_layouter->insertValue(m_thicknessRow, m_layer->thickness());
} }
......
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