Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgValidatorAboveZero.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
8#include "Logger.h"
9#include <QDoubleValidator>
10#include <QLocale>
11
13 QObject *parent) :
15 m_locale (locale)
16{
17 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorAboveZero::DlgValidatorAboveZero";
18}
19
21 int &pos) const
22{
23 // First do standard check
24 QDoubleValidator validator;
25 validator.setLocale (m_locale);
26 QValidator::State state = validator.validate (input,
27 pos);
28 if (state == QValidator::Acceptable) {
29
30 if (m_locale.toDouble (input) <= 0.0) {
31
32 // Cannot allow negative number or zero value
33 state = QValidator::Invalid;
34
35 }
36 }
37
38 return state;
39}
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
virtual QValidator::State validate(QString &input, int &pos) const
Apply the standard validation with 0 as the exclusive minimum. Call setCoordScale just before calling...
DlgValidatorAboveZero(const QLocale &locale, QObject *parent=0)
Single constructor.
Abstract validator for all numeric formats.
virtual QValidator::State validate(QString &input, int &pos) const =0
Validate according to the numeric format specific to the leaf class.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18