forked from qt-creator/qt-creator
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:
@@ -356,7 +356,10 @@ bool compareJavaScriptExpression(const QString &expression1, const QString &expr
|
|||||||
|
|
||||||
bool smartVeryFuzzyCompare(const QVariant &value1, const QVariant &value2)
|
bool smartVeryFuzzyCompare(const QVariant &value1, const QVariant &value2)
|
||||||
{ //we ignore slight changes on doubles and only check three digits
|
{ //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;
|
bool ok1, ok2;
|
||||||
qreal a = value1.toDouble(&ok1);
|
qreal a = value1.toDouble(&ok1);
|
||||||
qreal b = value2.toDouble(&ok2);
|
qreal b = value2.toDouble(&ok2);
|
||||||
|
Reference in New Issue
Block a user