Engauge Digitizer
2
Loading...
Searching...
No Matches
Dlg
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
7
#include "
DlgValidatorAboveZero.h
"
8
#include "
Logger.h
"
9
#include <QDoubleValidator>
10
#include <QLocale>
11
12
DlgValidatorAboveZero::DlgValidatorAboveZero
(
const
QLocale &locale,
13
QObject *parent) :
14
DlgValidatorAbstract
(parent),
15
m_locale (locale)
16
{
17
LOG4CPP_INFO_S
((*
mainCat
)) <<
"DlgValidatorAboveZero::DlgValidatorAboveZero"
;
18
}
19
20
QValidator::State
DlgValidatorAboveZero::validate
(QString &input,
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
}
DlgValidatorAboveZero.h
mainCat
log4cpp::Category * mainCat
Definition
Logger.cpp:14
Logger.h
DlgValidatorAboveZero::validate
virtual QValidator::State validate(QString &input, int &pos) const
Apply the standard validation with 0 as the exclusive minimum. Call setCoordScale just before calling...
Definition
DlgValidatorAboveZero.cpp:20
DlgValidatorAboveZero::DlgValidatorAboveZero
DlgValidatorAboveZero(const QLocale &locale, QObject *parent=0)
Single constructor.
Definition
DlgValidatorAboveZero.cpp:12
DlgValidatorAbstract::DlgValidatorAbstract
DlgValidatorAbstract(QObject *parent=0)
Single constructor.
Definition
DlgValidatorAbstract.cpp:10
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition
convenience.h:18
Generated on
for Engauge Digitizer by
1.14.0