45 #ifndef QT_NO_VALIDATOR 46 #include "private/qobject_p.h" 47 #include "private/qlocale_p.h" 389 return (
int)log10(
double(n)) + 1;
395 for (
int i = 0; i < exp; ++i)
418 if (buff.
size() == 1 && (buff.
at(0) ==
'+' || buff.
at(0) ==
'-'))
426 if (entered >=
b && entered <=
t) {
686 # define LLONG_MAX Q_INT64_C(0x7fffffffffffffff) 694 switch (
d->notation) {
703 State currentLocaleValidation =
d->validateWithLocale(input, numMode,
locale());
705 return currentLocaleValidation;
707 return qMax(currentLocaleValidation, cLocaleValidation);
733 if (i >= q->b && i <= q->
t)
830 d->notation = newNotation;
963 if (const_cast<QRegExp &>(
r).matchedLength() == input.
size()) {
992 #endif // QT_NO_VALIDATOR
Notation
This enum defines the allowed notations for entering a double.
static qint64 bytearrayToLongLong(const char *num, int base, bool *ok, bool *overflow=0)
#define QT_END_NAMESPACE
This macro expands to.
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
QValidator::State validate(QString &, int &) const
Returns Acceptable if the input is an integer within the valid range, Intermediate if the input is a ...
The QRegExp class provides pattern matching using regular expressions.
The QByteArray class provides an array of bytes.
virtual void fixup(QString &) const
This function attempts to change input to be valid according to this validator's rules.
QLocale locale() const
Returns the locale for the validator.
QValidator::State validateWithLocale(QString &input, QLocalePrivate::NumberMode numMode, const QLocale &locale) const
static double bytearrayToDouble(const char *num, bool *ok, bool *overflow=0)
The QString class provides a Unicode character string.
~QRegExpValidator()
Destroys the validator.
Q_DECL_CONSTEXPR T qAbs(const T &t)
The QObject class is the base class of all Qt objects.
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
void setNotation(Notation)
QString toString(qlonglong i) const
Returns a localized string representation of i.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
virtual void setRange(int bottom, int top)
Sets the range of the validator to only accept integers between bottom and top inclusive.
void setObjectName(const QString &name)
QValidator(QObject *parent=0)
Sets up the validator.
QDoubleValidator::Notation notation
QLocale::Language language
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QValidator class provides validation of input text.
int size() const
Returns the number of characters in this string.
static int numDigits(qlonglong n)
virtual void setRange(double bottom, double top, int decimals=0)
Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits ...
~QIntValidator()
Destroys the validator.
QIntValidator(QObject *parent=0)
Constructs a validator with a parent object that accepts all integers.
QValidator::State validate(QString &, int &) const
Returns Acceptable if the string input contains a double that is within the valid range and is in the...
QDoubleValidator(QObject *parent=0)
Constructs a validator object with a parent object that accepts any double.
The State element defines configurations of objects and properties.
~QValidator()
Destroys the validator, freeing any storage and other resources used.
const char * constData() const
Returns a pointer to the data stored in the byte array.
~QDoubleValidator()
Destroys the validator.
void setRegExp(const QRegExp &rx)
const QLocalePrivate * d() const
#define Q_DECLARE_PUBLIC(Class)
void fixup(QString &input) const
Reimplemented Function
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
void setLocale(const QLocale &locale)
Sets the locale that will be used for the validator.
QObject * parent() const
Returns a pointer to the parent object.
virtual QValidator::State validate(QString &input, int &pos) const
Returns Acceptable if input is matched by the regular expression for this validator, Intermediate if it has matched partially (i.e.
static qlonglong pow10(int exp)
State
This enum type defines the states in which a validated string can exist.
int size() const
Returns the number of bytes in this byte array.
bool exactMatch(const QString &str) const
Returns true if str is matched exactly by this regular expression; otherwise returns false...
bool validateChars(const QString &str, NumberMode numMode, QByteArray *buff, int decDigits=-1) const
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QDoubleValidatorPrivate()
QRegExpValidator(QObject *parent=0)
Constructs a validator with a parent object that accepts any string (including an empty one) as valid...
Notation notation() const
int toInt(const QString &s, bool *ok=0, int base=0) const
Returns the int represented by the localized string s, using base base.
char at(int i) const
Returns the character at index position i in the byte array.
The QDoubleValidator class provides range checking of floating-point numbers.