diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-19 14:52:19 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-11-23 14:13:42 +0000 |
commit | 15b5b3b3f01e400e46fe67babe593ede373dac4b (patch) | |
tree | 823f6a27092b9647dbe1f4a9004c99e9975e71c7 /src/gui | |
parent | 726fed0d67013cbfac7921d3d4613ca83406fb0f (diff) |
Add flags to omit/reject padding in scientific notation exponents
The EcmaScript format for printing doubles in exponent form differs
from Qt's format only in this aspect. EcmaScript explicitly prohibits
leading zeroes in exponents. It is thus worthwhile to add those flags
in order to be able to generate and parse doubles in compliance with
EcmaScript.
[ChangeLog][QtCore][QLocale] Additional flags in QLocale::NumberOption
allow generating and parsing doubles in EcmaScript compliant format.
Change-Id: Ia7b82c2e67bb8b80bd890014ff5cd4563faf2a03
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/util/qvalidator.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 4a92b7ea3a..aceda62a2a 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -399,8 +399,8 @@ static qlonglong pow10(int exp) QValidator::State QIntValidator::validate(QString & input, int&) const { QByteArray buff; - if (!locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, &buff, - -1, locale().numberOptions() & QLocale::RejectGroupSeparator)) { + if (!locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, &buff, -1, + locale().numberOptions())) { return Invalid; } @@ -439,8 +439,8 @@ QValidator::State QIntValidator::validate(QString & input, int&) const void QIntValidator::fixup(QString &input) const { QByteArray buff; - if (!locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, &buff, - -1, locale().numberOptions() & QLocale::RejectGroupSeparator)) { + if (!locale().d->m_data->validateChars(input, QLocaleData::IntegerMode, &buff, -1, + locale().numberOptions())) { return; } bool ok, overflow; @@ -663,8 +663,7 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL { Q_Q(const QDoubleValidator); QByteArray buff; - if (!locale.d->m_data->validateChars(input, numMode, &buff, q->dec, - locale.numberOptions() & QLocale::RejectGroupSeparator)) { + if (!locale.d->m_data->validateChars(input, numMode, &buff, q->dec, locale.numberOptions())) { return QValidator::Invalid; } |