From 726fed0d67013cbfac7921d3d4613ca83406fb0f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 16 Oct 2015 16:52:51 +0200 Subject: Interpret precision == -128 as "shortest" double conversion Also use this for converting doubles with QVariant. We generally want exact results there, rather than adding rounding errors whenever we convert. [ChangeLog][QtCore][QLocale] Added special value for double conversion precision to get shortest accurate representation. Change-Id: I905b8a103f39adf31d24b6ce2c8a283cf271b597 Reviewed-by: Lars Knoll --- src/corelib/tools/qlocale.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib/tools/qlocale.h') diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 729fd73a5d..f64a25bd00 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -848,6 +848,10 @@ public: }; Q_DECLARE_FLAGS(NumberOptions, NumberOption) + enum FloatingPointPrecisionOption { + FloatingPointShortest = -128 + }; + enum CurrencySymbolFormat { CurrencyIsoCode, CurrencySymbol, -- cgit v1.2.3