forked from qt-creator/qt-creator
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:
@@ -62,10 +62,7 @@ QVariant PropertyEditorValue::value() const
|
|||||||
static bool cleverDoubleCompare(const QVariant &value1, const QVariant &value2)
|
static bool cleverDoubleCompare(const QVariant &value1, const QVariant &value2)
|
||||||
{ //we ignore slight changes on doubles
|
{ //we ignore slight changes on doubles
|
||||||
if ((value1.type() == QVariant::Double) && (value2.type() == QVariant::Double)) {
|
if ((value1.type() == QVariant::Double) && (value2.type() == QVariant::Double)) {
|
||||||
int a = value1.toDouble() * 100;
|
if (qFuzzyCompare(value1.toDouble(), value2.toDouble()))
|
||||||
int b = value2.toDouble() * 100;
|
|
||||||
|
|
||||||
if (qFuzzyCompare((qreal(a) / 100), (qreal(b) / 100)))
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user