IntValidator< T > Class Template Reference

An integer validator for text strings. More...

#include <IntValidator.h>

List of all members.

Public Member Functions

 IntValidator (QObject *pParent)
 IntValidator (T minimum, T maximum, QObject *pParent)
virtual ~IntValidator ()
void setMinimum (T minimum)
minimum () const
void setMaximum (T maximum)
maximum () const
void setRange (T minimum, T maximum)
virtual QValidator::State validate (QString &input, int &pos) const


Detailed Description

template<typename T>
class IntValidator< T >

An integer validator for text strings.

The IntValidator class extends the QValidator class to provide a validator for integer data types, including large integer types. The following data types are supported:

The behavior of IntValidator is similar to that of QIntValidator, except integer types larger than int are supported. The class defines a validation range bounded by a minimum and maximum value that is checked during the validation sequence.

Definition at line 41 of file IntValidator.h.


Constructor & Destructor Documentation

template<typename T>
IntValidator< T >::IntValidator ( QObject *  pParent  ) 

Creates an IntValidator object with a default range.

This constructor creates a default validator with the default minimum and maximum values set to std::numeric_limits<T>::min() and std::numeric_limits<T>::max().

Parameters:
pParent The parent object.
See also:
IntValidator(T, T, QObject*)

template<typename T>
IntValidator< T >::IntValidator ( minimum,
maximum,
QObject *  pParent 
)

Creates an IntValidator object with a given range.

This constructor creates a validator with the validation range set to the given minimum and maximum values.

Parameters:
minimum The minimum value for the validation range.
maximum The maximum value for the validation range.
pParent The parent object.
See also:
IntValidator(QObject*)

template<typename T>
virtual IntValidator< T >::~IntValidator (  )  [virtual]

Destroys the validator object.


Member Function Documentation

template<typename T>
void IntValidator< T >::setMinimum ( minimum  ) 

Sets the minimum value of the validation range.

Parameters:
minimum The minimum value.
See also:
setMaximum(), setRange()

template<typename T>
T IntValidator< T >::minimum (  )  const

Returns the minimum value of the validation range.

Returns:
The minimum value.
See also:
maximum()

template<typename T>
void IntValidator< T >::setMaximum ( maximum  ) 

Sets the maximum value of the validation range.

Parameters:
maximum The maximum value.
See also:
setMinimum(), setRange()

template<typename T>
T IntValidator< T >::maximum (  )  const

Returns the maximum value of the validation range.

Returns:
The maximum value.
See also:
minimum()

template<typename T>
void IntValidator< T >::setRange ( minimum,
maximum 
)

Sets the minimum and maximum values of the validation range.

Parameters:
minimum The minimum value.
maximum The maximum value.
See also:
setMinimum(), setMaximum()

template<typename T>
virtual QValidator::State IntValidator< T >::validate ( QString &  input,
int &  pos 
) const [virtual]

Validates the given text against the minimum and maximum integer values.

This method is typically called automatically by the widget containing the validator. The implementation converts the given string to an integer using the QString text conversion methods (e.g. QString::toInt()) and returns whether the string is or is not a valid integer within the validation range or if the string could be a valid integer with additional input.

Parameters:
input The text to validate.
pos The cursor position. This parameter is ignored.
Returns:
Returns QValidator::Intermediate if the input string is empty or if the input string contains only a positive (+) sign or negative (-) sign and a positive or negative value is allowed in the range. Returns QValidator::Acceptable if the string converts to a valid integer and is contained within the validation range. Returns QValidator::Invalid in all other cases.


Software Development Kit - Opticks 4.9.0 Build 16218