QmlDesigner: Simply use qFuzzyCompare

I think this was done to avoid "ugly"
floats, but any rounding should be done in the rewriter.

Task-number: QDS-2190
Change-Id: Ibc5fc2609b5ac332191b68fe17d76d9afca21f40
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2020-06-26 13:27:35 +02:00
parent 97ac63b401
commit 951c112fcc

View File

@@ -62,10 +62,7 @@ QVariant PropertyEditorValue::value() const
static bool cleverDoubleCompare(const QVariant &value1, const QVariant &value2)
{ //we ignore slight changes on doubles
if ((value1.type() == QVariant::Double) && (value2.type() == QVariant::Double)) {
int a = value1.toDouble() * 100;
int b = value2.toDouble() * 100;
if (qFuzzyCompare((qreal(a) / 100), (qreal(b) / 100)))
if (qFuzzyCompare(value1.toDouble(), value2.toDouble()))
return true;
}
return false;