Improve NodeInstanceMetaObject workaround for NaN values

The old was wrong in the assumption that the pointer is allways a
variant.

Reviewed-by: kkoehne
This commit is contained in:
Marco Bubke
2010-04-26 13:54:36 +02:00
committed by Kai Koehne
parent 75d1fa5d93
commit 2f5c906d18

View File

@@ -34,11 +34,24 @@ int NodeInstanceMetaObject::metaCall(QMetaObject::Call call, int id, void **a)
int metaCallReturnValue = -1; int metaCallReturnValue = -1;
if (call == QMetaObject::WriteProperty if (call == QMetaObject::WriteProperty
&& property(id).userType() == QMetaType::QVariant
&& reinterpret_cast<QVariant *>(a[0])->type() == QVariant::Double && reinterpret_cast<QVariant *>(a[0])->type() == QVariant::Double
&& qIsNaN(reinterpret_cast<QVariant *>(a[0])->toDouble())) { && qIsNaN(reinterpret_cast<QVariant *>(a[0])->toDouble())) {
return -1; return -1;
} }
if (call == QMetaObject::WriteProperty
&& property(id).userType() == QMetaType::Double
&& qIsNaN(*reinterpret_cast<double*>(a[0]))) {
return -1;
}
if (call == QMetaObject::WriteProperty
&& property(id).userType() == QMetaType::Float
&& qIsNaN(*reinterpret_cast<float*>(a[0]))) {
return -1;
}
QVariant oldValue; QVariant oldValue;
if (call == QMetaObject::WriteProperty && !property(id).hasNotifySignal()) if (call == QMetaObject::WriteProperty && !property(id).hasNotifySignal())