From d15914d374df8d51c68d6a2d1966e5b01f179bb5 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Mon, 4 Dec 2023 10:07:27 +0100 Subject: [PATCH] deduplicate enforcing v>=0 --- GUI/View/Device/SpanPropertyForm.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/GUI/View/Device/SpanPropertyForm.cpp b/GUI/View/Device/SpanPropertyForm.cpp index 06c547a0119..530031a63a4 100644 --- a/GUI/View/Device/SpanPropertyForm.cpp +++ b/GUI/View/Device/SpanPropertyForm.cpp @@ -13,6 +13,7 @@ // ************************************************************************************************ #include "GUI/View/Device/SpanPropertyForm.h" +#include "Base/Util/Assert.h" #include "GUI/Model/Descriptor/SpanProperty.h" #include "GUI/Model/Project/ProjectDocument.h" #include "GUI/View/Numeric/DoubleSpinBox.h" @@ -42,14 +43,10 @@ SpanPropertyForm::SpanPropertyForm(QWidget* parent, const QString& groupTitle, m_centerSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, spanProperty->center()); connect(m_widthSpinBox, &DoubleSpinBox::baseValueChanged, [this](double v) { - if (v < 0) { - m_spanProperty->setWidth(0); - m_widthSpinBox->updateValue(); - } else { - if (m_spanProperty->width() == v) - return; - m_spanProperty->setWidth(v); - } + ASSERT(v >= 0); // spin box should have got limits from property + if (m_spanProperty->width() == v) + return; + m_spanProperty->setWidth(v); emit dataChanged(); }); -- GitLab