KDELibs4Support

knumvalidator.h
1 /**********************************************************************
2 **
3 ** Copyright (C) 1999 Glen Parker <[email protected]>
4 ** Copyright (C) 2002 Marc Mutz <[email protected]>
5 **
6 ** This library is free software; you can redistribute it and/or
7 ** modify it under the terms of the GNU Library General Public
8 ** License as published by the Free Software Foundation; either
9 ** version 2 of the License, or (at your option) any later version.
10 **
11 ** This library is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ** Library General Public License for more details.
15 **
16 ** You should have received a copy of the GNU Library General Public
17 ** License along with this library; if not, write to the Free
18 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 **
20 *****************************************************************************/
21 
22 #ifndef KNUMVALIDATOR_H
23 #define KNUMVALIDATOR_H
24 
25 #include <kdelibs4support_export.h>
26 
27 #include <QValidator>
28 
29 class QWidget;
30 class QString;
31 
42 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KIntValidator : public QValidator
43 {
44 
45 public:
49  KDELIBS4SUPPORT_DEPRECATED explicit KIntValidator(QWidget *parent, int base = 10);
53  KIntValidator(int bottom, int top, QWidget *parent, int base = 10);
57  virtual ~KIntValidator();
61  State validate(QString &, int &) const override;
65  void fixup(QString &) const override;
70  virtual void setRange(int bottom, int top);
74  virtual void setBase(int base);
78  virtual int bottom() const;
82  virtual int top() const;
86  virtual int base() const;
87 
88 private:
89  class KIntValidatorPrivate;
90  KIntValidatorPrivate *const d;
91 };
92 
106 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KDoubleValidator : public QDoubleValidator
107 {
108  Q_OBJECT
109  Q_PROPERTY(bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers)
110 public:
114  KDELIBS4SUPPORT_DEPRECATED explicit KDoubleValidator(QObject *parent);
118  KDoubleValidator(double bottom, double top, int decimals,
119  QObject *parent);
122  virtual ~KDoubleValidator();
123 
125  QValidator::State validate(QString &input, int &pos) const override;
126 
128  bool acceptLocalizedNumbers() const;
130  void setAcceptLocalizedNumbers(bool accept);
131 
132 private:
133  typedef QDoubleValidator base;
134  class KDoubleValidatorPrivate;
135  KDoubleValidatorPrivate *const d;
136 };
137 
138 #endif
virtual void fixup(QString &input) const const
virtual QValidator::State validate(QString &input, int &pos) const const override
QValidator for integers.
Definition: knumvalidator.h:42
A locale-aware QDoubleValidator.
virtual QValidator::State validate(QString &input, int &pos) const const =0
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 5 2020 22:58:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.