Commit a6c6bad5 authored by Volker Krause's avatar Volker Krause
Browse files

Adapt generic QVariant creation to Qt6 API

parent aaad7198
......@@ -270,7 +270,11 @@ static QVariant createInstance(const QJsonObject& obj, const QString &type)
return QLatin1String(lhs.name) < rhs;
});
if (it != registry.end() && QLatin1String((*it).name) == type) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QVariant value((*it).metaTypeId, nullptr);
#else
QVariant value(QMetaType((*it).metaTypeId), nullptr);
#endif
createInstance((*it).mo, value.data(), obj);
return value;
}
......@@ -299,7 +303,11 @@ static QVariant createInstance(const QJsonObject &obj, const QMetaProperty &prop
// if @type is (wrongly) not specified, try to recover from our own knowledge of a property type
const auto mo = QMetaType::metaObjectForType(prop.userType());
if (mo) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QVariant value(prop.userType(), nullptr);
#else
QVariant value(prop.metaType(), nullptr);
#endif
createInstance(mo, value.data(), obj);
return value;
}
......@@ -572,7 +580,11 @@ QVariant JsonLdDocument::apply(const QVariant& lhs, const QVariant& rhs)
}
auto valueData = mt.create();
*reinterpret_cast<int*>(valueData) = numValue;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QVariant value(prop.userType(), valueData);
#else
QVariant value(prop.metaType(), valueData);
#endif
prop.writeOnGadget(res.data(), value);
continue;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment