From efce5d8361af41bf60dd16ce5aec65fe2fd84f88 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 27 Nov 2013 09:11:28 +0100 Subject: 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 --- src/corelib/tools/qlocale_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 428593b3f3..f39705dfb2 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()) -- cgit v1.2.3