diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2013-11-27 08:11:28 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-30 06:02:24 (GMT) |
commit | efce5d8361af41bf60dd16ce5aec65fe2fd84f88 (patch) | |
tree | 63d65e10b3d24ab61743dcc71a9e1e8560564a67 /src | |
parent | 3f2f403191ea5a38c66b79840e3a33e05827d580 (diff) | |
download | Qt-efce5d8361af41bf60dd16ce5aec65fe2fd84f88.zip Qt-efce5d8361af41bf60dd16ce5aec65fe2fd84f88.tar.gz Qt-efce5d8361af41bf60dd16ce5aec65fe2fd84f88.tar.bz2 |
Improve digitToCLocale sign char handling
This patch adds more char tests for the plus and minus signs to
ensure that e.g. number input widgets can be used with the locale
and the known sign chars.
[ChangeLog][QtCore] Fixed a bug that caused negative number input
using '-' to be rejected because the current locale uses e.g. 0x2212.
QIntValidator and QDoubleValidator now accepts both signs as well as
the locale minus sign.
Task-number: QTBUG-35069
(cherry picked from commit qtbase/dc80838a378268a13ccbe74b481528f1ad631918)
Change-Id: I924bebe51028c58454eb864ad07d4af5efe3b5c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qlocale_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 428593b..f39705d 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -234,10 +234,10 @@ inline char QLocalePrivate::digitToCLocale(const QChar &in) const if (in.unicode() >= '0' && in.unicode() <= '9') return in.toLatin1(); - if (in == plus()) + if (in == plus() || in == QLatin1Char('+')) return '+'; - if (in == minus()) + if (in == minus() || in == QLatin1Char('-') || in == QChar(0x2212)) return '-'; if (in == decimal()) |