Open obscuren opened 9 years ago
After doing some testing the above possible solution didn't turn out to work properly.
I've updated it with the following (and will send a proper PR once fully tested)
case QMetaType::User:
{
if (qvar->userType() == 1034)
{
auto var = qvar->value<QJSValue>().toVariant();
packDataValue(&var, value);
}
else
{
qDebug() << "user-type =" << qvar->userType() << " name =" << QVariant::typeToName(qvar->userType());
}
}
break;
I've left the qDebug
in for debugging purposes (hasn't occurred yet after some testing). I also couldn't find a proper constant for 1034
(i.e. QJSValue
).
Created PR, see https://github.com/go-qml/qml/pull/140
I see this error when trying to pass a Javascript array to a function on an object exported from Go.
The diff from the PR fixes it for me.
Just to add, I've been seeing the same error, when passing a javascript array out from QML to a go function on Qt 5.4.2. But I don't know where it crept in exactly, as I did a go get -u on go-qml and upgraded from Qt5.2 at the same time...
Anyway, PR #140 also fixed it for me.
Using QT 5.4.0 with qml v1 and exporting the following object:
Will result in:
panic: unsupported variant type: 1024 (QJSValue)
Possible solution On https://github.com/go-qml/qml/blob/v1/cpp/capi.cpp#L725 add a
case QMetaType::User: