kdeui
KStringListValidator Class Reference
A QValidator to (dis)allow certain strings. More...
#include <kstringvalidator.h>
Public Member Functions | |
virtual void | fixup (QString &input) const |
bool | isFixupEnabled () const |
bool | isRejecting () const |
KStringListValidator (const QStringList &list=QStringList(), bool rejecting=true, bool fixupEnabled=false, QObject *parent=0, const char *name=0) | |
void | setFixupEnabled (bool fixupEnabled) |
void | setRejecting (bool rejecting) |
void | setStringList (const QStringList &list) |
QStringList | stringList () const |
virtual State | validate (QString &input, int &pos) const |
Protected Attributes | |
bool | mFixupEnabled |
bool | mRejecting |
QStringList | mStringList |
Properties | |
bool | fixupEnabled |
bool | rejecting |
QStringList | stringList |
Detailed Description
A QValidator to (dis)allow certain strings.This validator allows you to accept only certain or to accept all but certain strings.
When used in rejecting mode, accepts only strings not in the stringlist. This mode is the default and comes in handy when asking the user for a name of some listed entity. Set the list of already used names to prevent the user from entering duplicate names.
When used in non-rejecting mode, accepts only strings that appear in the stringlist. Use with care! From a user's point of view this mode is hard to grasp.
This validator can also fix strings. In rejecting mode, a number will be appended to the string until it is Acceptable. E.g. if "foo" and "foo 1" are in the stringlist, then fixup will change "foo" to "foo 2", provided "foo 2" isn't in the list of forbidden strings.
In accepting mode, when the input starts with an Acceptable substring, truncates to the longest Acceptable string. When the input is the start of an Acceptable string, completes to the shortest Acceptable string.
NOTE: fixup isn't yet implemented.
Definition at line 60 of file kstringvalidator.h.
Constructor & Destructor Documentation
KStringListValidator::KStringListValidator | ( | const QStringList & | list = QStringList() , |
|
bool | rejecting = true , |
|||
bool | fixupEnabled = false , |
|||
QObject * | parent = 0 , |
|||
const char * | name = 0 | |||
) | [inline] |
Construct a new validator.
- Parameters:
-
list The list of strings to (dis)allow. rejecting Selects the validator's mode (rejecting: true; accepting: false) fixupEnabled Selects whether to fix strings or not. parent Passed to lower level constructor. name Passed to lower level constructor
Definition at line 76 of file kstringvalidator.h.
Member Function Documentation
void KStringListValidator::fixup | ( | QString & | input | ) | const [virtual] |
bool KStringListValidator::isFixupEnabled | ( | ) | const [inline] |
Definition at line 89 of file kstringvalidator.h.
bool KStringListValidator::isRejecting | ( | ) | const [inline] |
Definition at line 86 of file kstringvalidator.h.
void KStringListValidator::setFixupEnabled | ( | bool | fixupEnabled | ) | [inline] |
Definition at line 88 of file kstringvalidator.h.
void KStringListValidator::setRejecting | ( | bool | rejecting | ) | [inline] |
Definition at line 85 of file kstringvalidator.h.
void KStringListValidator::setStringList | ( | const QStringList & | list | ) | [inline] |
Definition at line 91 of file kstringvalidator.h.
QStringList KStringListValidator::stringList | ( | ) | const [inline] |
Definition at line 92 of file kstringvalidator.h.
QValidator::State KStringListValidator::validate | ( | QString & | input, | |
int & | pos | |||
) | const [virtual] |
Member Data Documentation
bool KStringListValidator::mFixupEnabled [protected] |
Definition at line 97 of file kstringvalidator.h.
bool KStringListValidator::mRejecting [protected] |
Definition at line 96 of file kstringvalidator.h.
QStringList KStringListValidator::mStringList [protected] |
Definition at line 95 of file kstringvalidator.h.
Property Documentation
bool KStringListValidator::fixupEnabled [read, write] |
Definition at line 64 of file kstringvalidator.h.
bool KStringListValidator::rejecting [read, write] |
Definition at line 63 of file kstringvalidator.h.
QStringList KStringListValidator::stringList [read, write] |
Definition at line 62 of file kstringvalidator.h.
The documentation for this class was generated from the following files: