20 #ifndef QGSLONGLONGVALIDATOR_H
21 #define QGSLONGLONGVALIDATOR_H
33 : QValidator( parent )
34 , b( std::numeric_limits<qint64>::
min() )
35 , t( std::numeric_limits<qint64>::
max() )
39 : QValidator( parent )
47 QValidator::State validate( QString &input,
int& )
const
49 if ( input.isEmpty() )
52 if ( b >= 0 && input.startsWith(
'-' ) )
55 if ( t < 0 && input.startsWith(
'+' ) )
58 if ( input ==
"-" || input ==
"+" )
63 qlonglong entered = input.toLongLong( &ok );
67 if ( entered >= b && entered <= t )
74 return ( entered > t && -entered < b ) ? Invalid : Intermediate;
78 return ( entered < b ) ? Invalid : Intermediate;
83 void setTop( qint64 top ) { t = top; }
85 virtual void setRange( qint64 bottom, qint64 top )
92 qint64
top()
const {
return t; }
101 #endif // QGSLONGLONGVALIDATOR_H