kstringvalidator.h
/*
kstringvalidator.h
Copyright (c) 2001 Marc Mutz <mutz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; version 2.0
of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef __KSTRINGVALIDATOR_H__
#define __KSTRINGVALIDATOR_H__
#include <qvalidator.h>
#include <qstringlist.h>
#include <kdelibs_export.h>
class KDEUI_EXPORT KStringListValidator : public QValidator {
Q_OBJECT
Q_PROPERTY( QStringList stringList READ stringList WRITE setStringList )
Q_PROPERTY( bool rejecting READ isRejecting WRITE setRejecting )
Q_PROPERTY( bool fixupEnabled READ isFixupEnabled WRITE setFixupEnabled )
public:
KStringListValidator( const QStringList & list=QStringList(),
bool rejecting=true, bool fixupEnabled=false,
QObject * parent=0, const char * name=0 )
: QValidator( parent, name ), mStringList( list ),
mRejecting( rejecting ), mFixupEnabled( fixupEnabled ) {}
virtual State validate( QString & input, int & pos ) const;
virtual void fixup( QString & input ) const;
void setRejecting( bool rejecting ) { mRejecting = rejecting; }
bool isRejecting() const { return mRejecting; }
void setFixupEnabled( bool fixupEnabled ) { mFixupEnabled = fixupEnabled; }
bool isFixupEnabled() const { return mFixupEnabled; }
void setStringList( const QStringList & list ) { mStringList = list; }
QStringList stringList() const { return mStringList; }
protected:
QStringList mStringList;
bool mRejecting;
bool mFixupEnabled;
private:
class KStringListValidator* d;
};
class KDEUI_EXPORT KMimeTypeValidator : public QValidator
{
Q_OBJECT
public:
KMimeTypeValidator( QObject* parent, const char* name=0)
: QValidator( parent, name ) {}
virtual State validate( QString & input, int & pos ) const;
virtual void fixup( QString & input ) const;
private:
class KMimeTypeValidator* d;
};
#endif // __KSTRINGVALIDATOR_H__
KMimeTypeValidator
A QValidator for mime types.
Definition: kstringvalidator.h:119
KStringListValidator::KStringListValidator
KStringListValidator(const QStringList &list=QStringList(), bool rejecting=true, bool fixupEnabled=false, QObject *parent=0, const char *name=0)
Construct a new validator.
Definition: kstringvalidator.h:76
KStringListValidator
A QValidator to (dis)allow certain strings.
Definition: kstringvalidator.h:60

KDE Home | KDE Accessibility Home | Description of Access Keys