Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
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. More...
 
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. More...
 
- Public Member Functions inherited from DlgValidatorAbstract
 DlgValidatorAbstract (QObject *parent=0)
 Single constructor. More...
 
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 ( const QLocale &  locale,
QObject *  parent = 0 
)

Single constructor.

Definition at line 12 of file DlgValidatorAboveZero.cpp.

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

Member Function Documentation

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: