From a9e9100481f23d3cd64f3694850f03b73e9ccf70 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 25 Oct 2019 15:45:29 +0200 Subject: [PATCH] QmlDesigner: Use fuzzy compare for floats This fixes a soft assert when comparing floats. Change-Id: Id1626ab0ad2d777e6b67983210becdc8a32a95d2 Reviewed-by: Thomas Hartmann --- .../qmldesigner/designercore/model/texttomodelmerger.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp index b2e5e3a8b84..69bc9ff0f92 100644 --- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp +++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp @@ -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);