20 #ifndef QGSLONGLONGVALIDATOR_H
21 #define QGSLONGLONGVALIDATOR_H
38 : QValidator( parent )
39 , b( std::numeric_limits<qint64>::min() )
40 , t( std::numeric_limits<qint64>::max() )
44 : QValidator( parent )
49 QValidator::State
validate( QString &input,
int & )
const override
51 if ( input.isEmpty() )
54 if ( b >= 0 && input.startsWith(
'-' ) )
57 if ( t < 0 && input.startsWith(
'+' ) )
60 if ( input == QLatin1String(
"-" ) || input == QLatin1String(
"+" ) )
65 qlonglong entered = input.toLongLong( &ok );
69 if ( entered >= b && entered <= t )
76 return ( entered > t && -entered < b ) ? Invalid : Intermediate;
80 return ( entered < b ) ? Invalid : Intermediate;
85 void setTop( qint64 top ) { t = top; }
87 virtual void setRange( qint64 bottom, qint64 top )
94 qint64
top()
const {
return t; }
103 #endif // QGSLONGLONGVALIDATOR_H