KStringListValidator

Search for usage in LXR

KStringListValidator Class Reference

#include <kstringvalidator.h>

Inheritance diagram for KStringListValidator:

Properties

bool fixupEnabled
 
bool rejecting
 
QStringList stringList
 
- Properties inherited from QObject
 objectName
 

Public Member Functions

 KStringListValidator (const QStringList &list=QStringList(), bool rejecting=true, bool fixupEnabled=false, QObject *parent=nullptr)
 
 ~KStringListValidator () override
 
void fixup (QString &input) const override
 
bool isFixupEnabled () const
 
bool isRejecting () const
 
void setFixupEnabled (bool fixupEnabled)
 
void setRejecting (bool rejecting)
 
void setStringList (const QStringList &list)
 
QStringList stringList () const
 
State validate (QString &input, int &pos) const override
 
- Public Member Functions inherited from QValidator
 QValidator (QObject *parent)
 
void changed ()
 
QLocale locale () const const
 
void setLocale (const QLocale &locale)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Public Types inherited from QValidator
enum  State
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QValidator
 Acceptable
 
 Intermediate
 
 Invalid
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

A QValidator to (dis)allow certain strings.

Deprecated:
since 5.0

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 [email protected][email protected]kde.[email protected]org

Definition at line 61 of file kstringvalidator.h.

Constructor & Destructor Documentation

◆ KStringListValidator()

KStringListValidator::KStringListValidator ( const QStringList list = QStringList(),
bool  rejecting = true,
bool  fixupEnabled = false,
QObject parent = nullptr 
)
explicit

Creates a new string validator.

Parameters
listThe list of strings to (dis)allow.
rejectingSelects the validator's mode (rejecting: true; accepting: false)
fixupEnabledSelects whether to fix strings or not.
parentPassed to lower level constructor.

Definition at line 35 of file kstringvalidator.cpp.

◆ ~KStringListValidator()

KStringListValidator::~KStringListValidator ( )
override

Destroys the string validator.

Definition at line 45 of file kstringvalidator.cpp.

Member Function Documentation

◆ fixup()

void KStringListValidator::fixup ( QString input) const
overridevirtual

Reimplemented from.

See also
QValidator.

Reimplemented from QValidator.

Definition at line 74 of file kstringvalidator.cpp.

◆ isFixupEnabled()

bool KStringListValidator::isFixupEnabled ( ) const

Returns whether the fixup flag is set.

Definition at line 103 of file kstringvalidator.cpp.

◆ isRejecting()

bool KStringListValidator::isRejecting ( ) const

Returns whether the string validator is in rejecting mode.

Definition at line 93 of file kstringvalidator.cpp.

◆ setFixupEnabled()

void KStringListValidator::setFixupEnabled ( bool  fixupEnabled)

Sets the fixup flag.

If enabled, wrong input is corrected automatically.

Definition at line 98 of file kstringvalidator.cpp.

◆ setRejecting()

void KStringListValidator::setRejecting ( bool  rejecting)

Sets whether the string validator is in rejecting mode or not.

If in rejecting mode, the strings from

See also
stringList are not allowed to appear in the validation string.

Definition at line 88 of file kstringvalidator.cpp.

◆ setStringList()

void KStringListValidator::setStringList ( const QStringList list)

Sets the.

Parameters
listof string which is used as black or white list, depending on the rejecting mode (
See also
isRejecting()).

Definition at line 108 of file kstringvalidator.cpp.

◆ stringList()

QStringList KStringListValidator::stringList ( ) const

Returns the string list of the validator.

◆ validate()

QValidator::State KStringListValidator::validate ( QString input,
int &  pos 
) const
overridevirtual

Reimplemented from.

See also
QValidator.

Implements QValidator.

Definition at line 50 of file kstringvalidator.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:56:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.