Skip to content
Snippets Groups Projects
Commit d1d666c9 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.rewriter: fix for assert

In some cases we get a string and have to convert the string explicitly.
Task-number: QTCREATORBUG-5503

Change-Id: I1008deffeb8ede54911f1a7031edd41b5827c010
Reviewed-on: http://codereview.qt.nokia.com/1842


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 0f855763
No related branches found
No related tags found
No related merge requests found
......@@ -644,9 +644,13 @@ using namespace QmlDesigner::Internal;
static inline bool smartVeryFuzzyCompare(QVariant value1, QVariant value2)
{ //we ignore slight changes on doubles and only check three digits
if ((value1.type() == QVariant::Double) && (value2.type() == QVariant::Double)) {
int a = value1.toDouble() * 1000;
int b = value2.toDouble() * 1000;
if ((value1.type() == QVariant::Double) || (value2.type() == QVariant::Double)) {
bool ok1, ok2;
int a = value1.toDouble(&ok1) * 1000;
int b = value2.toDouble(&ok2) * 1000;
if (!ok1 || !ok2)
return false;
if (qFuzzyCompare((qreal(a) / 1000), (qreal(b) / 1000))) {
return true;
......@@ -657,8 +661,8 @@ static inline bool smartVeryFuzzyCompare(QVariant value1, QVariant value2)
static inline bool equals(const QVariant &a, const QVariant &b)
{
if (a.type() == QVariant::Double && b.type() == QVariant::Double)
return smartVeryFuzzyCompare(a.toDouble(), b.toDouble());
if (smartVeryFuzzyCompare(a, b))
return true;
else
return a == b;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment