7 #include "DlgValidatorNumber.h" 9 #include <QDoubleValidator> 13 const QLocale &locale,
16 m_coordScale (coordScale),
19 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgValidatorNumber::DlgValidatorNumber";
26 QDoubleValidator validator;
27 validator.setLocale (m_locale);
28 QValidator::State state = validator.validate (input,
30 if (state == QValidator::Acceptable) {
32 if (m_coordScale == COORD_SCALE_LOG) {
33 if (m_locale.toDouble (input) < 0.0) {
36 state = QValidator::Invalid;
38 }
if (m_locale.toDouble (input) == 0.0) {
41 state = QValidator::Intermediate;
Abstract validator for all numeric formats.
DlgValidatorNumber(CoordScale coordScale, const QLocale &locale, QObject *parent=0)
Single constructor.
virtual QValidator::State validate(QString &input, int &pos) const
Apply the standard validation with 0 as the exclusive minimum. Call setCoordScale just before calling...