Fixed convertJSObjectToVariant

This commit is contained in:
ksuprynowicz 2023-01-22 15:23:10 +01:00
parent 539c2812c3
commit a7b1fdcae6
3 changed files with 5 additions and 6 deletions

View file

@ -593,7 +593,7 @@ bool ScriptEngineV8::convertJSObjectToVariant(v8::Local<v8::Object> object, QVar
return false;
}
int length = names->Length();
QHash<QString, QVariant> properties;
QMap<QString, QVariant> properties;
for (int i = 0; i < length; i++) {
v8::Local<v8::Value> v8Property;
QString name = *v8::String::Utf8Value(_v8Isolate, names->Get(context, i).ToLocalChecked());

View file

@ -147,7 +147,7 @@ ScriptObjectV8Proxy* ScriptObjectV8Proxy::unwrapProxy(const V8ScriptValue& val)
}
v8::Local<v8::Object> v8Object = v8::Local<v8::Object>::Cast(v8Value);
if (v8Object->InternalFieldCount() != 3) {
qDebug(scriptengine) << "Cannot unwrap proxy - wrong number of internal fields";
//qDebug(scriptengine) << "Cannot unwrap proxy - wrong number of internal fields";
return nullptr;
}
if (v8Object->GetAlignedPointerFromInternalField(0) != internalPointsToQObjectProxy) {

View file

@ -133,12 +133,12 @@ QJsonDocument variantMapToJsonDocument(const QSettings::SettingsMap& map) {
}
switch (variantType) {
// V8TODO: why was this here? It seems that it supported
/*case QVariant::Hash: {
// QML has problems with QVariant::Hash
case QVariant::Hash: {
qCritical() << "Unsupported variant type" << variant.typeName() << ";" << key << variant;
Q_ASSERT(false);
break;
}*/
}
case QVariant::Invalid:
object.insert(key, QJsonValue());
@ -150,7 +150,6 @@ QJsonDocument variantMapToJsonDocument(const QSettings::SettingsMap& map) {
case QVariant::Bool:
case QVariant::Double:
case QVariant::Map:
case QVariant::Hash:
case QVariant::List:
object.insert(key, QJsonValue::fromVariant(variant));
break;