diff options
author | Adriaan de Groot <groot@kde.org> | 2020-04-08 17:10:32 +0200 |
---|---|---|
committer | Adriaan de Groot <groot@kde.org> | 2020-04-08 17:10:32 +0200 |
commit | 16a5ca2a5595cbf11cc9074b00baded789668997 (patch) | |
tree | 4832c5a452152865c93a9839f06430e9c0b92298 | |
parent | 3b354b8b20ec7bda66bddec6b5379f011eda997b (diff) |
[libcalamares] Format floats with trailing digits
- When writing YAML, given a float **always** write
some decimal digits (e.g. "1.0" rather than "1")
so that the type of the written-out thing stays
float.
- Avoids test failure with the sample `welcome.conf`
file which reads 1.0 and would write out 1, which then
led to type differences.
-rw-r--r-- | src/libcalamares/utils/Yaml.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcalamares/utils/Yaml.cpp b/src/libcalamares/utils/Yaml.cpp index 92ce9e6a0..b33ca3137 100644 --- a/src/libcalamares/utils/Yaml.cpp +++ b/src/libcalamares/utils/Yaml.cpp @@ -266,7 +266,7 @@ dumpYamlElement( QFile& f, const QVariant& value, int indent ) } else if ( value.type() == QVariant::Type::Double ) { - f.write( QString::number( value.toDouble() ).toUtf8() ); + f.write( QString::number( value.toDouble(), 'f', 2 ).toUtf8() ); } else if ( value.canConvert( QVariant::Type::ULongLong ) ) { |