Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgValidatorAboveZero Class Reference

Validator for generic (=simple) numbers that must be greater than zero. More...

#include <DlgValidatorAboveZero.h>

Inheritance diagram for DlgValidatorAboveZero:
Inheritance graph
Collaboration diagram for DlgValidatorAboveZero:
Collaboration graph

Public Member Functions

 DlgValidatorAboveZero (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 this method.
Public Member Functions inherited from DlgValidatorAbstract
 DlgValidatorAbstract (QObject *parent=0)
 Single constructor.
virtual ~DlgValidatorAbstract ()

Detailed Description

Validator for generic (=simple) numbers that must be greater than zero.

Definition at line 14 of file DlgValidatorAboveZero.h.

Constructor & Destructor Documentation

◆ DlgValidatorAboveZero()

DlgValidatorAboveZero::DlgValidatorAboveZero ( const QLocale & locale,
QObject * parent = 0 )

Single constructor.

Definition at line 12 of file DlgValidatorAboveZero.cpp.

13 :
15 m_locale (locale)
16{
17 LOG4CPP_INFO_S ((*mainCat)) << "DlgValidatorAboveZero::DlgValidatorAboveZero";
18}
log4cpp::Category * mainCat
Definition Logger.cpp:14
DlgValidatorAbstract(QObject *parent=0)
Single constructor.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

Member Function Documentation

◆ validate()

QValidator::State DlgValidatorAboveZero::validate ( QString & input,
int & pos ) const
virtual

Apply the standard validation with 0 as the exclusive minimum. Call setCoordScale just before calling this method.

Implements DlgValidatorAbstract.

Definition at line 20 of file DlgValidatorAboveZero.cpp.

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}

The documentation for this class was generated from the following files: