Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QDS_StringValidator Class Reference

A validator for string values. More...

#include <QDS_Validator.h>

Inheritance diagram for QDS_StringValidator:
Inheritance graph

Public Member Functions

 QDS_StringValidator (QObject *p=0)
 Constructor. More...
 
 QDS_StringValidator (const QString &f, QObject *p=0)
 Constructor. More...
 
 QDS_StringValidator (const QString &ft, const QString &fg, QObject *p=0)
 Constructor. More...
 
virtual ~QDS_StringValidator ()
 Destructor. More...
 
virtual State validate (QString &, int &) const
 Validate the entered string input. More...
 
int length () const
 Get maximum valid string length. More...
 
void setLength (const int)
 Set maximum valid string length. More...
 

Private Attributes

int myLen
 string length More...
 
QString myFlags
 string format flags More...
 
QString myFilter
 string filter More...
 

Detailed Description

This class provides validation of the strings entered by the user for datum with 'String' value type according to datum properties: format, filter.

Inherits from QValidator.

Constructor & Destructor Documentation

QDS_StringValidator::QDS_StringValidator ( QObject p = 0)

Create empty validator object.

Parameters
pparent object
QDS_StringValidator::QDS_StringValidator ( const QString &  f,
QObject p = 0 
)

Create validator object with filter string f.

Parameters
ffilter string
pparent object
QDS_StringValidator::QDS_StringValidator ( const QString &  ft,
const QString &  fg,
QObject p = 0 
)

Create validator object with filter string ft and format flags fg.

Parameters
ftfilter string
fgformat string
pparent object
QDS_StringValidator::~QDS_StringValidator ( )
virtual

Member Function Documentation

int QDS_StringValidator::length ( ) const

If maximum length is not specified, -1 is returned.

Returns
maximum string length

References myLen.

void QDS_StringValidator::setLength ( const int  l)

If l <= 0 is not specified, maximum valid length is reset (any string length is valid).

Parameters
lmaximum strin length

References myLen.

QValidator::State QDS_StringValidator::validate ( QString &  input,
int &  pos 
) const
virtual

Reimplemented from QValidator.

Convert specified string to the upper/lower case if the format flags contains specificator 'u'/'l' correspondingly. If valid string length is specified, then check given string length. If filter is specified, then perform also validation with filter by QRegExpValidator.

Returns QValidator::Invalid if input is invalid according to this validator's rules, QValidator::Intermediate if it is likely that a little more editing will make the input acceptable and QValidator::Acceptable if the input is valid.

Parameters
inputstring being validated
poscursor position
Returns
validation state (QValidator::State)

References myFilter, myFlags, and myLen.

Member Data Documentation

QString QDS_StringValidator::myFilter
private
QString QDS_StringValidator::myFlags
private
int QDS_StringValidator::myLen
private

The documentation for this class was generated from the following files: