• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • util
knumvalidator.h
Go to the documentation of this file.
1/**********************************************************************
2**
3** Copyright (C) 1999 Glen Parker <glenebob@nwlink.com>
4** Copyright (C) 2002 Marc Mutz <mutz@kde.org>
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 <kdeui_export.h>
26
27#include <QtGui/QValidator>
28
29class QWidget;
30class QString;
31
42class KDEUI_EXPORT KIntValidator : public QValidator {
43
44 public:
48 explicit KIntValidator ( QWidget * parent, int base = 10 );
52 KIntValidator ( int bottom, int top, QWidget * parent, int base = 10 );
56 virtual ~KIntValidator ();
60 virtual State validate ( QString &, int & ) const;
64 virtual void fixup ( QString & ) const;
69 virtual void setRange ( int bottom, int top );
73 virtual void setBase ( int base );
77 virtual int bottom () const;
81 virtual int top () const;
85 virtual int base () const;
86
87 private:
88 class KIntValidatorPrivate;
89 KIntValidatorPrivate * const d;
90};
91
104class KDEUI_EXPORT_DEPRECATED KFloatValidator : public QValidator {
105
106 public:
110 explicit KFloatValidator ( QWidget * parent );
114 KFloatValidator ( double bottom, double top, QWidget * parent );
118 KFloatValidator ( double bottom, double top, bool localeAware, QWidget * parent );
122 virtual ~KFloatValidator ();
126 virtual State validate ( QString &, int & ) const;
130 virtual void fixup ( QString & ) const;
134 virtual void setRange ( double bottom, double top );
138 virtual double bottom () const;
142 virtual double top () const;
148 void setAcceptLocalizedNumbers(bool b);
153 bool acceptLocalizedNumbers() const;
154
155 private:
156 class KFloatValidatorPrivate;
157 KFloatValidatorPrivate * const d;
158};
159
172
173class KDEUI_EXPORT KDoubleValidator : public QDoubleValidator {
174 Q_OBJECT
175 Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers )
176public:
180 explicit KDoubleValidator( QObject * parent );
184 KDoubleValidator( double bottom, double top, int decimals,
185 QObject * parent );
188 virtual ~KDoubleValidator();
189
191 virtual QValidator::State validate( QString & input, int & pos ) const;
192
194 bool acceptLocalizedNumbers() const;
196 void setAcceptLocalizedNumbers( bool accept );
197
198private:
199 typedef QDoubleValidator base;
200 class KDoubleValidatorPrivate;
201 KDoubleValidatorPrivate * const d;
202};
203
204#endif
KDoubleValidator::setAcceptLocalizedNumbers
void setAcceptLocalizedNumbers(bool accept)
Sets whether to accept localized numbers (default: true)
Definition knumvalidator.cpp:322
KDoubleValidator::KDoubleValidator
KDoubleValidator(QObject *parent)
Constuct a locale-aware KDoubleValidator with default range (whatever QDoubleValidator uses for that)...
Definition knumvalidator.cpp:302
KDoubleValidator::acceptLocalizedNumbers
bool acceptLocalizedNumbers
Definition knumvalidator.h:175
KDoubleValidator::validate
virtual QValidator::State validate(QString &input, int &pos) const
Overloaded for internal reasons.
Definition knumvalidator.cpp:326
KFloatValidator::setRange
virtual void setRange(double bottom, double top)
Sets the minimum and maximum value allowed.
Definition knumvalidator.cpp:269
KFloatValidator::setAcceptLocalizedNumbers
void setAcceptLocalizedNumbers(bool b)
Sets the validator to be locale aware if is true.
Definition knumvalidator.cpp:196
KFloatValidator::top
virtual double top() const
Returns the current maximum value allowed.
Definition knumvalidator.cpp:283
KFloatValidator::validate
virtual State validate(QString &, int &) const
Validates the text, and return the result.
Definition knumvalidator.cpp:206
KFloatValidator::KFloatValidator
KFloatValidator(QWidget *parent)
Constructor.
Definition knumvalidator.cpp:171
KFloatValidator::fixup
virtual void fixup(QString &) const
Fixes the text if possible, providing a valid string.
Definition knumvalidator.cpp:247
KFloatValidator::acceptLocalizedNumbers
bool acceptLocalizedNumbers() const
Returns true if the validator is locale aware.
Definition knumvalidator.cpp:201
KFloatValidator::bottom
virtual double bottom() const
Returns the current minimum value allowed.
Definition knumvalidator.cpp:278
KIntValidator::validate
virtual State validate(QString &, int &) const
Validates the text, and return the result.
Definition knumvalidator.cpp:66
KIntValidator::base
virtual int base() const
Returns the current numeric base.
Definition knumvalidator.cpp:149
KIntValidator::KIntValidator
KIntValidator(QWidget *parent, int base=10)
Constructor.
Definition knumvalidator.cpp:48
KIntValidator::top
virtual int top() const
Returns the current maximum value allowed.
Definition knumvalidator.cpp:144
KIntValidator::setRange
virtual void setRange(int bottom, int top)
Sets the minimum and maximum values allowed.
Definition knumvalidator.cpp:123
KIntValidator::bottom
virtual int bottom() const
Returns the current minimum value allowed.
Definition knumvalidator.cpp:139
KIntValidator::setBase
virtual void setBase(int base)
Sets the numeric base value.
Definition knumvalidator.cpp:132
KIntValidator::fixup
virtual void fixup(QString &) const
Fixes the text if possible, providing a valid string.
Definition knumvalidator.cpp:101
QDoubleValidator
QObject
QValidator
QWidget
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal