diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-15 15:40:26 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-11-02 17:00:50 +0000 |
commit | 8c2ca33073f20e1fe552bd8b5f663aec5b8a634d (patch) | |
tree | a8277e71b865e3e08908a4937668e163c35a03e6 /src/gui/util | |
parent | 84042523f272c1d30247e9329eea21036ff793f4 (diff) |
Replace qdtoa and qstrtod implementation by a 3rdparty library
This also fixes the underlying cause of QTBUG-44039 and QTBUG-43885.
You can choose between system, qt, and no libdouble-conversion
support. If you choose "no", snprintf_l and sscanf_l will be
used.
By default, system double conversion is used if the system provides a
double-conversion library. Otherwise the bundled libdouble-conversion
is built. sscanf_l and snprintf_l are not used by default as the
planned "shortest" conversion mode to produce the shortest possible
string will give less precise results when implemented with snprintf_l.
Change-Id: I8ca08a0fca5c54cf7009e48e771385614f6aa031
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qvalidator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 31dfd20d1a..4a92b7ea3a 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -38,6 +38,7 @@ #ifndef QT_NO_VALIDATOR #include "private/qobject_p.h" #include "private/qlocale_p.h" +#include "private/qnumeric_p.h" #include <limits.h> #include <cmath> @@ -676,9 +677,9 @@ QValidator::State QDoubleValidatorPrivate::validateWithLocale(QString &input, QL if (q->t < 0 && buff.startsWith('+')) return QValidator::Invalid; - bool ok, overflow; - double i = QLocaleData::bytearrayToDouble(buff.constData(), &ok, &overflow); - if (overflow) + bool ok = false; + double i = buff.toDouble(&ok); // returns 0.0 if !ok + if (i == qt_qnan()) return QValidator::Invalid; if (!ok) return QValidator::Intermediate; |