Source Code (Use browser search to find items of interest.)
Class Index
qt'QIntValidator (./qt-2.1.0/src/widgets/qvalidator.h:55)
class Q_EXPORT QIntValidator: public QValidator
{
Q_OBJECT
Q_PROPERTY( int bottom READ bottom WRITE setBottom )
Q_PROPERTY( int top READ top WRITE setTop )
public:
QIntValidator( QWidget * parent, const char *name = 0 );
QIntValidator( int bottom, int top,
QWidget * parent, const char *name = 0 );
~QIntValidator();
QValidator::State validate( QString &, int & ) const;
void setBottom( int );
void setTop( int );
virtual void setRange( int bottom, int top );
int bottom() const { return b; }
int top() const { return t; }
private:
int b, t;
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
QIntValidator( const QIntValidator & );
QIntValidator& operator=( const QIntValidator & );
#endif
};
qt'QIntValidator::QIntValidator() (./qt-2.1.0/src/widgets/qvalidator.cpp:189)
QIntValidator::QIntValidator( QWidget * parent, const char *name )
: QValidator( parent, name )
{
b = INT_MIN;
t = INT_MAX;
}
/*!
Constructs a validator object which accepts all integers from \a
bottom up to and including \a top.
*/
qt'QIntValidator::QIntValidator() (./qt-2.1.0/src/widgets/qvalidator.cpp:202)
QIntValidator::QIntValidator( int bottom, int top,
QWidget * parent, const char* name )
: QValidator( parent, name )
{
b = bottom;
t = top;
}
/*!
Destroys the validator, freeing any storage and other resources
used.
*/
qt'QIntValidator::~QIntValidator() (./qt-2.1.0/src/widgets/qvalidator.cpp:216)
QIntValidator::~QIntValidator()
{
// nothing
}
/*! Returns \a Acceptable if \a input contains a number in the legal
range, \a Intermediate if it contains another integer or is empty,
and \a Invalid if \a input is not an integer.
*/
QValidator::State QIntValidator::validate( QString & input, int & ) const
{
QRegExp empty( QString::fromLatin1("^ *-? *$") );
if ( empty.match( input ) >= 0 )
return QValidator::Intermediate;
bool ok;
long int tmp = input.toLong( &ok );
if ( !ok )
return QValidator::Invalid;
else if ( tmp < b || tmp > t )
return QValidator::Valid;
else
return QValidator::Acceptable;
}
/*!
Sets the validator to accept only number from \a bottom up to an
including \a top.
*/
qt'QIntValidator::setRange() (./qt-2.1.0/src/widgets/qvalidator.cpp:248)
void QIntValidator::setRange( int bottom, int top )
{
b = bottom;
t = top;
}
/*!
Sets the validator to accept no numbers smaller than \a bottom.
\sa setRange()
*/
qt'QIntValidator::setBottom() (./qt-2.1.0/src/widgets/qvalidator.cpp:259)
void QIntValidator::setBottom( int bottom )
{
setRange( bottom, top() );
}
/*!
Sets the validator to accept no numbers bigger than \a top.
\sa setRange()
*/
qt'QIntValidator::setTop() (./qt-2.1.0/src/widgets/qvalidator.cpp:269)
void QIntValidator::setTop( int top )
{
setRange( bottom(), top );
}
/*!
\fn int QIntValidator::bottom() const
Returns the lowest valid number according to this validator.
\sa top() setRange()
*/
/*!
\fn int QIntValidator::top() const
Returns the highest valid number according to this validator.
\sa bottom() setRange()
*/
/*!
\class QDoubleValidator qvalidator.h
\brief The QDoubleValidator class provides range checking of
floating-point numbers.
\ingroup misc
QDoubleValidator provides an upper bound, a lower bound, and a limit
on the number of digits after the decimal point. It does not
provide a fixup() function.
\sa QIntValidator
*/
/*!
Constructs a validator object which accepts all doubles.
*/