Commit 914f12ba authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.rewriter: string fix

Change-Id: I9a46704c24bdd9ddfd24ba2cf76eb2573f1cf5ef
Reviewed-on: http://codereview.qt.nokia.com/2441Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent bfed87f9
......@@ -54,6 +54,14 @@ inline static QString properColorName(const QColor &color)
return s;
}
inline static QString doubleToString(double d)
{
QString string = QString::number(d, 'f', 3);
if (string.endsWith(".000"))
string.chop(4);
return string;
}
QmlTextGenerator::QmlTextGenerator(const QStringList &propertyOrder, int indentDepth):
m_propertyOrder(propertyOrder),
m_indentDepth(indentDepth)
......@@ -116,7 +124,7 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept
return QString(QLatin1String("\"%1\"")).arg(properColorName(value.value<QColor>()));
case QVariant::Double:
return QString::number(value.toDouble(), 'f', 3);
return doubleToString(value.toDouble());
case QVariant::Int:
case QVariant::LongLong:
case QVariant::UInt:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment