Open obscuren opened 9 years ago
I tried this with limetext/qml .. however for me the userType is 1051 ... will try a way to not hardcode this
Here is what i ended up with, which seems to work:
diff --git a/cpp/capi.cpp b/cpp/capi.cpp
index 55ac585..c2255aa 100644
--- a/cpp/capi.cpp
+++ b/cpp/capi.cpp
@@ -745,7 +745,8 @@ void packDataValue(QVariant_ *var, DataValue *value)
break;
case QMetaType::User:
{
- if (qvar->userType() == 1034) {
+ static const int qjstype = QVariant::fromValue(QJSValue()).userType();
+ if (qvar->userType() == qjstype) {
auto var = qvar->value<QJSValue>().toVariant();
packDataValue(&var, value);
}
Confirmed. @pjoe change works. Updated PR.
We need a test case exercising the issue to make sure we understand the problem and it doesn't not regress.
Also, can you please sign the agreement so we can get the change in:
I don't think it was c288002b52e905973b131089a8a7c761d4a2c36a was intended to be part of the original PR, but it may be obsoleted by 154c0d11e675c3ee440e05fe005428a74d9b9e17 which was merged in 2ee7e5ff737026a4dfa89801fac63561279040f4
@niemyer, please can you merge this in. It's really useful.
Added proper casting from QMetaType::User (1024) with userType 1034 (i.e., QJSValue) to QVariant so it can be handled properly by the packDataValue method.