summaryrefslogtreecommitdiffstats
path: root/doc/src
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2012-01-22 21:23:50 +0000
committerQt by Nokia <qt-info@nokia.com>2012-02-05 17:49:42 +0100
commit1e3833bed8a661ee8ae284188a23bd0ffc3bed85 (patch)
tree3731cf72c2f2b70ab48703130206b2e5f442e6d4 /doc/src
parent96501b0a18f4f70048403dccc4cb42dd71db8f9d (diff)
QString: Make convert to number methods only use C locale
Ensure consistent conversions by not using the system default locale. Change-Id: I60db9fc4f465c0254f3213419e57d7879aaddd65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/snippets/qstring/main.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/doc/src/snippets/qstring/main.cpp b/doc/src/snippets/qstring/main.cpp
index 48bfea9e53..d0a445731c 100644
--- a/doc/src/snippets/qstring/main.cpp
+++ b/doc/src/snippets/qstring/main.cpp
@@ -737,20 +737,15 @@ void Widget::toDoubleFunction()
d = QString( "1234.56e-02" ).toDouble(&ok); // ok == true, d == 12.3456
//! [67]
- //! [68] //! [69]
- QLocale::setDefault(QLocale::C);
- d = QString( "1234,56" ).toDouble(&ok); // ok == false
//! [68]
+ d = QString( "1234,56" ).toDouble(&ok); // ok == false
d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56
+ //! [68]
- //! [69] //! [70]
- QLocale::setDefault(QLocale::German);
- d = QString( "1234,56" ).toDouble(&ok); // ok == true, d == 1234.56
- d = QString( "1234.56" ).toDouble(&ok); // ok == true, d == 1234.56
-
- //! [70]
- QLocale::setDefault(QLocale::C);
+ //! [69]
d = QString( "1,234,567.89" ).toDouble(&ok); // ok == false
+ d = QString( "1234567.89" ).toDouble(&ok); // ok == true
+ //! [69]
}
void Widget::toFloatFunction()