Skip to content
Snippets Groups Projects
Commit d15914d3 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

deduplicate enforcing v>=0

parent c71b2bb2
No related branches found
No related tags found
1 merge request!2194GUI SpanPropertyForm: rm coupling of span and width (#856)
Pipeline #122293 failed
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
// ************************************************************************************************ // ************************************************************************************************
#include "GUI/View/Device/SpanPropertyForm.h" #include "GUI/View/Device/SpanPropertyForm.h"
#include "Base/Util/Assert.h"
#include "GUI/Model/Descriptor/SpanProperty.h" #include "GUI/Model/Descriptor/SpanProperty.h"
#include "GUI/Model/Project/ProjectDocument.h" #include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/View/Numeric/DoubleSpinBox.h" #include "GUI/View/Numeric/DoubleSpinBox.h"
...@@ -42,14 +43,10 @@ SpanPropertyForm::SpanPropertyForm(QWidget* parent, const QString& groupTitle, ...@@ -42,14 +43,10 @@ SpanPropertyForm::SpanPropertyForm(QWidget* parent, const QString& groupTitle,
m_centerSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, spanProperty->center()); m_centerSpinBox = GUI::Util::createDoubleSpinBoxRow(layout, spanProperty->center());
connect(m_widthSpinBox, &DoubleSpinBox::baseValueChanged, [this](double v) { connect(m_widthSpinBox, &DoubleSpinBox::baseValueChanged, [this](double v) {
if (v < 0) { ASSERT(v >= 0); // spin box should have got limits from property
m_spanProperty->setWidth(0); if (m_spanProperty->width() == v)
m_widthSpinBox->updateValue(); return;
} else { m_spanProperty->setWidth(v);
if (m_spanProperty->width() == v)
return;
m_spanProperty->setWidth(v);
}
emit dataChanged(); emit dataChanged();
}); });
......
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