33 QValidator::State
validate(QString& input,
int& pos)
const override
36 if (input.isEmpty() || input ==
"." || input ==
"-")
return Intermediate;
38 QChar
const decimalPoint(
'.');
39 if (input.indexOf(decimalPoint) != -1)
41 int const charsAfterPoint = input.length() - input.indexOf(decimalPoint) - 1;
42 if (charsAfterPoint > decimals())
43 return QValidator::Invalid;
47 double const d = input.toDouble(&ok);
49 if (ok && d >= bottom() && d <= top())
50 return QValidator::Acceptable;
52 return QValidator::Invalid;