kexi

KexiUtils::MultiValidator Class Reference

#include <validator.h>

Inheritance diagram for KexiUtils::MultiValidator:

KexiUtils::Validator KexiDB::FieldValidator List of all members.

Detailed Description

A validator groupping multiple QValidators.

MultiValidator behaves like normal KexiUtils::Validator, but it allows to add define more than one different validator. Given validation is successful if every subvalidator accepted given value.

  • result of calling check() depends on value of check() returned by subvalidators:
    • Error is returned if at least one subvalidator returned Error;
    • Warning is returned if at least one subvalidator returned Warning and no validator returned error;
    • Ok is returned only if exactly all subvalidators returned Ok.
    • If there is no subvalidators defined, Error is always returned.
    • If a given subvalidator is not of class Validator but ust QValidator, it's assumed it's check() method returned Ok.

  • result of calling validate() (a method implemented for QValidator) depends on value of validate() returned by subvalidators:
    • Invalid is returned if at least one subvalidator returned Invalid
    • Intermediate is returned if at least one subvalidator returned Intermediate
    • Acceptable is returned if exactly all subvalidators returned Acceptable.
    • If there is no subvalidators defined, Invalid is always returned.

If there are no subvalidators, the multi validator always accepts the input.

Definition at line 120 of file validator.h.


Public Member Functions

 MultiValidator (QObject *parent=0, const char *name=0)
 MultiValidator (QValidator *validator, QObject *parent=0, const char *name=0)
void addSubvalidator (QValidator *validator, bool owned=true)
virtual QValidator::State validate (QString &input, int &pos) const
virtual void fixup (QString &input) const

Protected Attributes

QPtrList< QValidator > m_ownedSubValidators
QValueList< QValidator * > m_subValidators

Constructor & Destructor Documentation

MultiValidator::MultiValidator ( QObject *  parent = 0,
const char *  name = 0 
)

Constructs multivalidator with no subvalidators defined. You can add more validators with addSubvalidator().

Definition at line 60 of file validator.cpp.

MultiValidator::MultiValidator ( QValidator *  validator,
QObject *  parent = 0,
const char *  name = 0 
)

Constructs multivalidator with one validator validator. It will be owned if has no parent defined. You can add more validators with addSubvalidator().

Definition at line 66 of file validator.cpp.


Member Function Documentation

void MultiValidator::addSubvalidator ( QValidator *  validator,
bool  owned = true 
)

Adds validator validator as another subvalidator. Subvalidator will be owned by this multivalidator if owned is true and its parent is NULL.

Definition at line 74 of file validator.cpp.

QValidator::State MultiValidator::validate ( QString &  input,
int &  pos 
) const [virtual]

Reimplemented to call validate() on subvalidators.

Reimplemented from KexiUtils::Validator.

Definition at line 83 of file validator.cpp.

void MultiValidator::fixup ( QString &  input  )  const [virtual]

Calls QValidator::fixup() on every subvalidator. This may be senseless to use this methog in certain cases (can return weir results), so think twice before..

Definition at line 94 of file validator.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys