# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KStringListValidator Class Reference

A QValidator to (dis)allow certain strings. More...

`#include <kstringvalidator.h>`

Inheritance diagram for KStringListValidator:

[legend]
Collaboration diagram for KStringListValidator:

[legend]
List of all members.

## Public Member Functions

| 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 Attributes

QStringList | mStringList
bool | mRejecting
bool | mFixupEnabled

## Properties

QStringList | stringList
bool | rejecting
bool | fixupEnabled

## 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.

Author:
  Marc Mutz <mutz@kde.org>

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.

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

- kstringvalidator.h
- kstringvalidator.cpp

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:22:22 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003