8#include <QtGui/qtguiglobal.h>
9#include <QtCore/qobject.h>
10#include <QtCore/qstring.h>
11#if QT_CONFIG(regularexpression)
12# include <QtCore/qregularexpression.h>
14#include <QtCore/qlocale.h>
19#ifndef QT_NO_VALIDATOR
21class QValidatorPrivate;
27 explicit QValidator(QObject * parent =
nullptr);
37 void setLocale(
const QLocale &locale);
38 QLocale locale()
const;
40 virtual State validate(QString &,
int &)
const = 0;
41 virtual void fixup(QString &)
const;
47 QValidator(QObjectPrivate &d, QObject *parent);
48 QValidator(QValidatorPrivate &d, QObject *parent);
51 Q_DISABLE_COPY(QValidator)
52 Q_DECLARE_PRIVATE(QValidator)
58 Q_PROPERTY(
int bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
59 Q_PROPERTY(
int top READ top WRITE setTop NOTIFY topChanged)
62 explicit QIntValidator(QObject * parent =
nullptr);
63 QIntValidator(
int bottom,
int top, QObject *parent =
nullptr);
66 QValidator::State validate(QString &,
int &)
const override;
67 void fixup(QString &input)
const override;
71 void setRange(
int bottom,
int top);
73 int bottom()
const {
return b; }
74 int top()
const {
return t; }
76 void bottomChanged(
int bottom);
77 void topChanged(
int top);
80 Q_DISABLE_COPY(QIntValidator)
91 Q_PROPERTY(
double bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
92 Q_PROPERTY(
double top READ top WRITE setTop NOTIFY topChanged)
93 Q_PROPERTY(
int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged)
94 Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged)
97 explicit QDoubleValidator(QObject * parent =
nullptr);
98 QDoubleValidator(
double bottom,
double top,
int decimals, QObject *parent =
nullptr);
106 QValidator::State validate(QString &,
int &)
const override;
107 void fixup(QString &input)
const override;
109 void setRange(
double bottom,
double top,
int decimals);
110 void setRange(
double bottom,
double top);
111 void setBottom(
double);
113 void setDecimals(
int);
114 void setNotation(Notation);
116 double bottom()
const {
return b; }
117 double top()
const {
return t; }
118 int decimals()
const {
return dec; }
119 Notation notation()
const;
122 void bottomChanged(
double bottom);
123 void topChanged(
double top);
124 void decimalsChanged(
int decimals);
125 void notationChanged(QDoubleValidator::Notation notation);
128 Q_DECLARE_PRIVATE(QDoubleValidator)
129 Q_DISABLE_COPY(QDoubleValidator)
136#if QT_CONFIG(regularexpression)
138class QRegularExpressionValidatorPrivate;
140class Q_GUI_EXPORT QRegularExpressionValidator :
public QValidator
143 Q_PROPERTY(QRegularExpression regularExpression READ regularExpression WRITE setRegularExpression NOTIFY regularExpressionChanged)
146 explicit QRegularExpressionValidator(QObject *parent =
nullptr);
147 explicit QRegularExpressionValidator(
const QRegularExpression &re, QObject *parent =
nullptr);
148 ~QRegularExpressionValidator();
150 QValidator::State validate(QString &input,
int &pos)
const override;
152 QRegularExpression regularExpression()
const;
155 void setRegularExpression(
const QRegularExpression &re);
158 void regularExpressionChanged(
const QRegularExpression &re);
161 Q_DISABLE_COPY(QRegularExpressionValidator)
162 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.
Combined button and popup list for selecting options.
static qlonglong pow10(int exp)
static std::optional< QValidator::State > initialResultCheck(T min, T max, const ParsingResult &result)
static int numDigits(qlonglong n)