16 : QAbstractSpinBox(parent), d_format(format), d_min_val(-DBL_MAX), d_max_val(DBL_MAX), d_value(0.0), d_step(0.1),
21 setFocusPolicy(Qt::StrongFocus);
24 connect(
this, SIGNAL(editingFinished()),
this, SLOT(
interpretText()));
70 double value = locale().toDouble(text(), &ok);
75 QString val = text().remove(
",");
76 value = locale().toDouble(val, &ok);
83 if (specialTextMapping.first == text()) {
85 if (
setValue(specialTextMapping.second)) {
86 lineEdit()->setText(text());
118 QAbstractSpinBox::StepEnabled stepDown = QAbstractSpinBox::StepNone;
120 stepDown = StepDownEnabled;
122 QAbstractSpinBox::StepEnabled stepUp = QAbstractSpinBox::StepNone;
124 stepUp = StepUpEnabled;
126 return stepDown | stepUp;
130 const bool notify(
false);
148 return specialValueText();
160 return QAbstractSpinBox::focusInEvent(e);
174 d_spin_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
177 auto *l =
new QHBoxLayout(
this);
183 setFocusPolicy(Qt::StrongFocus);
192 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)