Skip to content
Snippets Groups Projects
Commit 2f5c906d authored by Marco Bubke's avatar Marco Bubke Committed by Kai Koehne
Browse files

Improve NodeInstanceMetaObject workaround for NaN values

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

Reviewed-by: kkoehne
parent 75d1fa5d
No related branches found
No related tags found
No related merge requests found
...@@ -34,11 +34,24 @@ int NodeInstanceMetaObject::metaCall(QMetaObject::Call call, int id, void **a) ...@@ -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())
......
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