kexi

KexiUtils::Validator Class Reference

#include <validator.h>

Inheritance diagram for KexiUtils::Validator:

KexiDB::ObjectNameValidator KexiUtils::IdentifierValidator KexiUtils::MultiValidator List of all members.

Detailed Description

KexiUtils::Validator class extends QValidator with offline-checking for value's validity (check() method). Thus, it groups two purposes into one container: -string validator for line editors (online checking, "on typing") -offline-checking for QVariant values, reimplementing validate().

It also offers error and warning messages for check() method. You may need to reimplement:

Definition at line 44 of file validator.h.


Public Types

enum  Result { Error = 0, Ok = 1, Warning = 2 }

Public Member Functions

 Validator (QObject *parent=0, const char *name=0)
virtual ~Validator ()
void setAcceptsEmptyValue (bool set)
bool acceptsEmptyValue () const
Result check (const QString &valueName, const QVariant &v, QString &message, QString &details)
virtual QValidator::State validate (QString &input, int &pos) const
void addChildValidator (Validator *v)

Static Public Member Functions

static const QString msgColumnNotEmpty ()

Protected Member Functions

virtual Result internalCheck (const QString &valueName, const QVariant &v, QString &message, QString &details)

Protected Attributes

bool m_acceptsEmptyValue: 1

Friends

class MultiValidator

Member Function Documentation

bool KexiUtils::Validator::acceptsEmptyValue  )  const [inline]
 

Return accepting empty values flag.

See also:
setAcceptsEmptyValue().

Definition at line 57 of file validator.h.

Validator::Result Validator::check const QString &  valueName,
const QVariant &  v,
QString &  message,
QString &  details
 

Checks if value v is ok and returns one of Result value: Error is returned on error, Ok on success, Warning if there is something to warn. In any case except Ok, i18n'ed message is set and (optionally) details are set, e.g. for use in a message box. valueName can be used to contruct message as well, for example: "[valueName] is not a valid login name". Depending on acceptsEmptyValue(), immediately accepts empty values or not.

Definition at line 34 of file validator.cpp.

static const QString KexiUtils::Validator::msgColumnNotEmpty  )  [inline, static]
 

Generic error/warning messages:.

Definition at line 74 of file validator.h.

void KexiUtils::Validator::setAcceptsEmptyValue bool  set  )  [inline]
 

Sets accepting empty values on (true) or off (false). By default the validator does not accepts empty values.

Definition at line 54 of file validator.h.

QValidator::State Validator::validate QString &  input,
int &  pos
const [virtual]
 

This implementation always return value QValidator::Acceptable.

Reimplemented in KexiUtils::IdentifierValidator, and KexiUtils::MultiValidator.

Definition at line 53 of file validator.cpp.


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