00001
00002
00003
00004
00005
00006
00007 #include "DlgValidatorAboveZero.h"
00008 #include "Logger.h"
00009 #include <QDoubleValidator>
00010 #include <QLocale>
00011
00012 DlgValidatorAboveZero::DlgValidatorAboveZero(const QLocale &locale,
00013 QObject *parent) :
00014 DlgValidatorAbstract(parent),
00015 m_locale (locale)
00016 {
00017 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorAboveZero::DlgValidatorAboveZero";
00018 }
00019
00020 QValidator::State DlgValidatorAboveZero::validate (QString &input,
00021 int &pos) const
00022 {
00023
00024 QDoubleValidator validator;
00025 validator.setLocale (m_locale);
00026 QValidator::State state = validator.validate (input,
00027 pos);
00028 if (state == QValidator::Acceptable) {
00029
00030 if (m_locale.toDouble (input) <= 0.0) {
00031
00032
00033 state = QValidator::Invalid;
00034
00035 }
00036 }
00037
00038 return state;
00039 }