forked from qt-creator/qt-creator
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:
@@ -34,11 +34,24 @@ int NodeInstanceMetaObject::metaCall(QMetaObject::Call call, int id, void **a)
|
||||
int metaCallReturnValue = -1;
|
||||
|
||||
if (call == QMetaObject::WriteProperty
|
||||
&& property(id).userType() == QMetaType::QVariant
|
||||
&& reinterpret_cast<QVariant *>(a[0])->type() == QVariant::Double
|
||||
&& qIsNaN(reinterpret_cast<QVariant *>(a[0])->toDouble())) {
|
||||
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;
|
||||
|
||||
if (call == QMetaObject::WriteProperty && !property(id).hasNotifySignal())
|
||||
|
||||
Reference in New Issue
Block a user