16 #include "Fit/Param/RealLimits.h"
17 #include <QDoubleSpinBox>
24 double singleStep(
int decimals)
27 return 1. / std::pow(10., decimals - 1);
35 auto* validator =
new QDoubleValidator(0.0, 1e+200, 1000, edit);
36 validator->setNotation(QDoubleValidator::ScientificNotation);
38 const double minimum =
39 limits.hasLowerLimit() ? std::max(limits.lowerLimit(), -1e+200) : -1e+200;
40 const double maximum =
41 limits.hasUpperLimit() ? std::min(limits.upperLimit(), +1e+200) : +1e+200;
42 validator->setRange(minimum, maximum, 1000);
44 edit->setValidator(validator);
48 const RealLimits& limits)
50 spinBox->setMaximum(std::numeric_limits<double>::max());
51 spinBox->setMinimum(std::numeric_limits<double>::lowest());
53 if (limits.hasLowerLimit())
54 spinBox->setMinimum(limits.lowerLimit());
55 if (limits.hasUpperLimit())
56 spinBox->setMaximum(limits.upperLimit());
58 spinBox->setDecimals(decimals);
59 spinBox->setSingleStep(singleStep(decimals));
Defines class GUIHelpers functions.
void configSpinbox(QDoubleSpinBox *spinBox, int decimals, const RealLimits &limits)
void configScientificDoubleEdit(QLineEdit *edit, const RealLimits &limits)