From d62ebb5cc452c894afde0da4ba4dd3bc2456ceb9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 22 May 2009 13:03:12 +1000 Subject: Don't rely on qreal being a double. --- src/declarative/qml/qmlmetaproperty.cpp | 16 ++++++++-------- src/declarative/qml/script/qmlbasicscript.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index e3e9ff5..3aa4f1d 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -730,19 +730,19 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value) switch(t) { case QVariant::Double: { - qreal r; + double d; bool found = true; if (vt == QVariant::Int) { - r = value.toInt(); + d = value.toInt(); } else if (vt == QVariant::UInt) { - r = value.toUInt(); + d = value.toUInt(); } else { found = false; } if (found) { void *a[1]; - a[0] = &r; + a[0] = &d; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); @@ -906,19 +906,19 @@ void QmlMetaProperty::write(const QVariant &value) const switch(t) { case QVariant::Double: { - qreal r; + double dd; bool found = true; if (vt == QVariant::Int) { - r = value.toInt(); + dd = value.toInt(); } else if (vt == QVariant::UInt) { - r = value.toUInt(); + dd = value.toUInt(); } else { found = false; } if (found) { void *a[1]; - a[0] = &r; + a[0] = ⅆ QMetaObject::metacall(object(), QMetaObject::WriteProperty, d->coreIdx, a); diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp index e0a668a..37a6678 100644 --- a/src/declarative/qml/script/qmlbasicscript.cpp +++ b/src/declarative/qml/script/qmlbasicscript.cpp @@ -139,9 +139,16 @@ static QVariant fetch_value(QObject *o, int idx, int type) } break; case 135: + { + float val; + void *args[] = { &val, 0 }; + QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); + return QVariant(val); + } + break; case QVariant::Double: { - qreal val; + double val; void *args[] = { &val, 0 }; QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); return QVariant(val); -- cgit v0.12