28 : QAbstractSpinBox(parent), d_format(format), d_min_val(-DBL_MAX), d_max_val(DBL_MAX), d_value(0.0), d_step(0.1),
33 setFocusPolicy(Qt::StrongFocus);
36 connect(
this, SIGNAL(editingFinished()),
this, SLOT(
interpretText()));
82 double value = locale().toDouble(text(), &ok);
87 QString val = text().remove(
",");
88 value = locale().toDouble(val, &ok);
95 if (specialTextMapping.first == text()) {
97 if (
setValue(specialTextMapping.second)) {
98 lineEdit()->setText(text());
130 QAbstractSpinBox::StepEnabled stepDown = QAbstractSpinBox::StepNone;
132 stepDown = StepDownEnabled;
134 QAbstractSpinBox::StepEnabled stepUp = QAbstractSpinBox::StepNone;
136 stepUp = StepUpEnabled;
138 return stepDown | stepUp;
142 const bool notify(
false);
160 return specialValueText();
172 return QAbstractSpinBox::focusInEvent(e);
186 d_spin_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
189 auto *l =
new QHBoxLayout(
this);
195 setFocusPolicy(Qt::StrongFocus);
204 double val = -DBL_MAX;
double value
The value of the point.
A QDoubleSpinBox allowing to customize numbers display with respect to.
void setSingleStep(double val)
void setRange(double min, double max)
QValidator::State validate(QString &input, int &pos) const override
std::map< QString, double > m_specialTextMappings
void setMaximum(double max)
void setMinimum(double min)
void valueChanged(double d)
void interpretText(bool notify=true)
Interpret the text and update the stored value.
void addSpecialTextMapping(const QString &text, double value)
Adds a mapping from string whihc may be entered into the edit box and a double value.
DoubleSpinBox(const char format='g', QWidget *parent=nullptr)
Constructor.
QString textFromValue(double value) const
void focusInEvent(QFocusEvent *) override
void activated(DoubleSpinBox *)
Signal emitted when the spin box gains focus.
void stepBy(int steps) override
bool setValue(double val)
StepEnabled stepEnabled() const override
DoubleSpinBox * d_spin_box
RangeLimitBox(LimitType type, QWidget *parent=nullptr)