QmlDesigner: Use fuzzy compare for floats

This fixes a soft assert when comparing floats.

Change-Id: Id1626ab0ad2d777e6b67983210becdc8a32a95d2
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2019-10-25 15:45:29 +02:00
parent 95bd328c31
commit a9e9100481

View File

@@ -356,7 +356,10 @@ bool compareJavaScriptExpression(const QString &expression1, const QString &expr
bool smartVeryFuzzyCompare(const QVariant &value1, const QVariant &value2)
{ //we ignore slight changes on doubles and only check three digits
if ((value1.type() == QVariant::Double) || (value2.type() == QVariant::Double)) {
if ((value1.type() == QMetaType::Double)
|| (value2.type() == QMetaType::Double)
|| (value1.type() == QMetaType::Float)
|| (value2.type() == QMetaType::Float)) {
bool ok1, ok2;
qreal a = value1.toDouble(&ok1);
qreal b = value2.toDouble(&ok2);