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
Change-Id: I857105ca38b1d3826e27eb64645fef07149d74bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Samuel Gaist 2013-11-27 09:11:28 +01:00 committed by The Qt Project
parent 9e64fc9e1c
commit dc80838a37

View File

@ -360,10 +360,10 @@ inline char QLocalePrivate::digitToCLocale(QChar in) const
if (in.unicode() >= '0' && in.unicode() <= '9') if (in.unicode() >= '0' && in.unicode() <= '9')
return in.toLatin1(); return in.toLatin1();
if (in == plus()) if (in == plus() || in == QLatin1Char('+'))
return '+'; return '+';
if (in == minus()) if (in == minus() || in == QLatin1Char('-') || in == QChar(0x2212))
return '-'; return '-';
if (in == decimal()) if (in == decimal())