class KStringListValidator

# class KStringListValidator | A QValidator to (dis)allow certain strings. More...
Definition | `#include <kstringvalidator.h>`
Inherits | QValidator (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KStringListValidator ( const QStringList & list=QStringList(), bool rejecting=true, bool fixupEnabled=false, QObject * parent=0, const char * name=0 )
- virtual State validate ( QString & input, int & pos ) const
- virtual void fixup ( QString & input ) const
- void setRejecting ( bool rejecting )
- bool isRejecting () const
- void setFixupEnabled ( bool fixupEnabled )
- bool isFixupEnabled () const
- void setStringList ( const QStringList & list )
- QStringList stringList () const

#### Protected Members

- QStringList mStringList
- bool mRejecting
- bool mFixupEnabled

## Detailed Description

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.

KStringListValidator ( const QStringList & list=QStringList(), bool rejecting=true, bool fixupEnabled=false, QObject * parent=0, const char * name=0 ) | ### KStringListValidator

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.

State validate ( QString & input, int & pos ) | ### validate

[const virtual]

void fixup ( QString & input ) | ### fixup

[const virtual]

Reimplemented from QValidator.

void setRejecting ( bool rejecting ) | ### setRejecting

bool isRejecting () | ### isRejecting

[const]

void setFixupEnabled ( bool fixupEnabled ) | ### setFixupEnabled

bool isFixupEnabled () | ### isFixupEnabled

[const]

void setStringList ( const QStringList & list ) | ### setStringList

QStringList stringList () | ### stringList

[const]

QStringList mStringList | ### mStringList

[protected]

bool mRejecting | ### mRejecting

[protected]

bool mFixupEnabled | ### mFixupEnabled

[protected]

- Author: Marc Mutz
- Generated: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:37 2003, using kdoc 2.0a54.