summaryrefslogtreecommitdiffstats
path: root/src/xml/dom/qdom.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-02-19 18:48:32 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-03-03 22:08:18 +0100
commit8c883c8da32faf1245d257f1fc1fb39fb2b63efc (patch)
treefcd34b906d9f2c24d3b19dd49940a7db05db5bad /src/xml/dom/qdom.cpp
parent4f370d36ec5caa02f78545ceee5704d94edf0530 (diff)
QDom: use correct precision when converting float/double values
d7cb21ac085117f879a8aa1d7727b2ca52d3353d change the way a double is converted which resulted in less precision. Fix it by explictily setting the precision in QString::setNum() Task-number: QTBUG-80068 Change-Id: I1fd9d00837155ceb707e84bfeb9deff03b5ab57e Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/xml/dom/qdom.cpp')
-rw-r--r--src/xml/dom/qdom.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 04151c3f31..04331527f9 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -62,6 +62,7 @@
#include <qshareddata.h>
#include <qdebug.h>
#include <stdio.h>
+#include <limits>
QT_BEGIN_NAMESPACE
@@ -4866,7 +4867,7 @@ void QDomElement::setAttribute(const QString& name, float value)
if (!impl)
return;
QString x;
- x.setNum(value);
+ x.setNum(value, 'g', 8);
IMPL->setAttribute(name, x);
}
@@ -4880,7 +4881,7 @@ void QDomElement::setAttribute(const QString& name, double value)
if (!impl)
return;
QString x;
- x.setNum(value);
+ x.setNum(value, 'g', 17);
IMPL->setAttribute(name, x);
}
@@ -5049,7 +5050,7 @@ void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, doub
if (!impl)
return;
QString x;
- x.setNum(value);
+ x.setNum(value, 'g', 17);
IMPL->setAttributeNS(nsURI, qName, x);
}