KDEUI
knumvalidator.h
Go to the documentation of this file.
00001 /********************************************************************** 00002 ** 00003 ** Copyright (C) 1999 Glen Parker <glenebob@nwlink.com> 00004 ** Copyright (C) 2002 Marc Mutz <mutz@kde.org> 00005 ** 00006 ** This library is free software; you can redistribute it and/or 00007 ** modify it under the terms of the GNU Library General Public 00008 ** License as published by the Free Software Foundation; either 00009 ** version 2 of the License, or (at your option) any later version. 00010 ** 00011 ** This library is distributed in the hope that it will be useful, 00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 ** Library General Public License for more details. 00015 ** 00016 ** You should have received a copy of the GNU Library General Public 00017 ** License along with this library; if not, write to the Free 00018 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 ** 00020 *****************************************************************************/ 00021 00022 #ifndef KNUMVALIDATOR_H 00023 #define KNUMVALIDATOR_H 00024 00025 #include <kdeui_export.h> 00026 00027 #include <QtGui/QValidator> 00028 00029 class QWidget; 00030 class QString; 00031 00042 class KDEUI_EXPORT KIntValidator : public QValidator { 00043 00044 public: 00048 explicit KIntValidator ( QWidget * parent, int base = 10 ); 00052 KIntValidator ( int bottom, int top, QWidget * parent, int base = 10 ); 00056 virtual ~KIntValidator (); 00060 virtual State validate ( QString &, int & ) const; 00064 virtual void fixup ( QString & ) const; 00069 virtual void setRange ( int bottom, int top ); 00073 virtual void setBase ( int base ); 00077 virtual int bottom () const; 00081 virtual int top () const; 00085 virtual int base () const; 00086 00087 private: 00088 class KIntValidatorPrivate; 00089 KIntValidatorPrivate * const d; 00090 }; 00091 00104 class KDEUI_EXPORT KFloatValidator : public QValidator { 00105 00106 public: 00110 explicit KFloatValidator ( QWidget * parent ); 00114 KFloatValidator ( double bottom, double top, QWidget * parent ); 00118 KFloatValidator ( double bottom, double top, bool localeAware, QWidget * parent ); 00122 virtual ~KFloatValidator (); 00126 virtual State validate ( QString &, int & ) const; 00130 virtual void fixup ( QString & ) const; 00134 virtual void setRange ( double bottom, double top ); 00138 virtual double bottom () const; 00142 virtual double top () const; 00148 void setAcceptLocalizedNumbers(bool b); 00153 bool acceptLocalizedNumbers() const; 00154 00155 private: 00156 class KFloatValidatorPrivate; 00157 KFloatValidatorPrivate * const d; 00158 }; 00159 00173 class KDEUI_EXPORT KDoubleValidator : public QDoubleValidator { 00174 Q_OBJECT 00175 Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers ) 00176 public: 00180 explicit KDoubleValidator( QObject * parent ); 00184 KDoubleValidator( double bottom, double top, int decimals, 00185 QObject * parent ); 00188 virtual ~KDoubleValidator(); 00189 00191 virtual QValidator::State validate( QString & input, int & pos ) const; 00192 00194 bool acceptLocalizedNumbers() const; 00196 void setAcceptLocalizedNumbers( bool accept ); 00197 00198 private: 00199 typedef QDoubleValidator base; 00200 class KDoubleValidatorPrivate; 00201 KDoubleValidatorPrivate * const d; 00202 }; 00203 00204 #endif
KDE 4.6 API Reference