23 QValidator::State
validate(QString& input,
int& pos)
const override
26 if (input.isEmpty() || input ==
"." || input ==
"-")
return Intermediate;
28 QChar
const decimalPoint(
'.');
29 if (input.indexOf(decimalPoint) != -1)
31 int const charsAfterPoint = input.length() - input.indexOf(decimalPoint) - 1;
32 if (charsAfterPoint > decimals())
33 return QValidator::Invalid;
37 double const d = input.toDouble(&ok);
39 if (ok && d >= bottom() && d <= top())
40 return QValidator::Acceptable;
42 return QValidator::Invalid;