From dc80838a378268a13ccbe74b481528f1ad631918 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 27 Nov 2013 09:11:28 +0100 Subject: [PATCH] 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 --- src/corelib/tools/qlocale_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 4b4606ffab..581a12e0c7 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -360,10 +360,10 @@ inline char QLocalePrivate::digitToCLocale(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())