9#include <QtGui/qtguiglobal.h>
10#include <QtCore/qobject.h>
11#include <QtCore/qstring.h>
12#if QT_CONFIG(regularexpression)
13# include <QtCore/qregularexpression.h>
15#include <QtCore/qlocale.h>
20#ifndef QT_NO_VALIDATOR
22class QValidatorPrivate;
28 explicit QValidator(QObject * parent =
nullptr);
38 void setLocale(
const QLocale &locale);
39 QLocale locale()
const;
41 virtual State validate(QString &,
int &)
const = 0;
42 virtual void fixup(QString &)
const;
48 QValidator(QObjectPrivate &d, QObject *parent);
49 QValidator(QValidatorPrivate &d, QObject *parent);
52 Q_DISABLE_COPY(QValidator)
53 Q_DECLARE_PRIVATE(QValidator)
59 Q_PROPERTY(
int bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
60 Q_PROPERTY(
int top READ top WRITE setTop NOTIFY topChanged)
63 explicit QIntValidator(QObject * parent =
nullptr);
64 QIntValidator(
int bottom,
int top, QObject *parent =
nullptr);
67 QValidator::State validate(QString &,
int &)
const override;
68 void fixup(QString &input)
const override;
72 void setRange(
int bottom,
int top);
74 int bottom()
const {
return b; }
75 int top()
const {
return t; }
77 void bottomChanged(
int bottom);
78 void topChanged(
int top);
81 Q_DISABLE_COPY(QIntValidator)
92 Q_PROPERTY(
double bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
93 Q_PROPERTY(
double top READ top WRITE setTop NOTIFY topChanged)
94 Q_PROPERTY(
int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged)
95 Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged)
98 explicit QDoubleValidator(QObject * parent =
nullptr);
99 QDoubleValidator(
double bottom,
double top,
int decimals, QObject *parent =
nullptr);
107 QValidator::State validate(QString &,
int &)
const override;
108 void fixup(QString &input)
const override;
110 void setRange(
double bottom,
double top,
int decimals);
111 void setRange(
double bottom,
double top);
112 void setBottom(
double);
114 void setDecimals(
int);
115 void setNotation(Notation);
117 double bottom()
const {
return b; }
118 double top()
const {
return t; }
119 int decimals()
const {
return dec; }
120 Notation notation()
const;
123 void bottomChanged(
double bottom);
124 void topChanged(
double top);
125 void decimalsChanged(
int decimals);
126 void notationChanged(QDoubleValidator::Notation notation);
129 Q_DECLARE_PRIVATE(QDoubleValidator)
130 Q_DISABLE_COPY(QDoubleValidator)
137#if QT_CONFIG(regularexpression)
139class QRegularExpressionValidatorPrivate;
141class Q_GUI_EXPORT QRegularExpressionValidator :
public QValidator
144 Q_PROPERTY(QRegularExpression regularExpression READ regularExpression WRITE setRegularExpression NOTIFY regularExpressionChanged)
147 explicit QRegularExpressionValidator(QObject *parent =
nullptr);
148 explicit QRegularExpressionValidator(
const QRegularExpression &re, QObject *parent =
nullptr);
149 ~QRegularExpressionValidator();
151 QValidator::State validate(QString &input,
int &pos)
const override;
153 QRegularExpression regularExpression()
const;
156 void setRegularExpression(
const QRegularExpression &re);
159 void regularExpressionChanged(
const QRegularExpression &re);
162 Q_DISABLE_COPY(QRegularExpressionValidator)
163 Q_DECLARE_PRIVATE(QRegularExpressionValidator)
void fixupWithLocale(QString &input, QLocaleData::NumberMode numMode, const QLocale &locale) const
The QDoubleValidator class provides range checking of floating-point numbers.
The QIntValidator class provides a validator that ensures a string contains a valid integer within a ...
The QValidator class provides validation of input text.
static qlonglong pow10(int exp)
static std::optional< QValidator::State > initialResultCheck(T min, T max, const QLocaleData::ParsingResult &result)
static int numDigits(qlonglong n)