Update tst_qcborstreamwriter to use QMetaType
Since the QVariant types are deprecated in Qt6, use QMetaType instead Change-Id: I7bddea15a3f1a534d3c6f6b9e7ddf9585a8423bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
02f429f06c
commit
b379e880a9
@ -69,33 +69,33 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v)
|
||||
{
|
||||
int type = v.userType();
|
||||
switch (type) {
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
return writer.append(v.toLongLong());
|
||||
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
return writer.append(v.toULongLong());
|
||||
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return writer.append(v.toBool());
|
||||
|
||||
case QVariant::Invalid:
|
||||
case QMetaType::UnknownType:
|
||||
return writer.appendUndefined();
|
||||
|
||||
case QMetaType::VoidStar:
|
||||
return writer.append(nullptr);
|
||||
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return writer.append(v.toDouble());
|
||||
|
||||
case QMetaType::Float:
|
||||
return writer.append(v.toFloat());
|
||||
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return writer.append(v.toString());
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
return writer.append(v.toByteArray());
|
||||
|
||||
default:
|
||||
@ -109,7 +109,7 @@ void encodeVariant(QCborStreamWriter &writer, const QVariant &v)
|
||||
writer.append(QCborTag(v.value<Tag>().tag));
|
||||
return encodeVariant(writer, v.value<Tag>().tagged);
|
||||
}
|
||||
if (type == QVariant::List || type == qMetaTypeId<IndeterminateLengthArray>()) {
|
||||
if (type == QMetaType::QVariantList || type == qMetaTypeId<IndeterminateLengthArray>()) {
|
||||
QVariantList list = v.toList();
|
||||
if (type == qMetaTypeId<IndeterminateLengthArray>()) {
|
||||
list = v.value<IndeterminateLengthArray>();
|
||||
|
Loading…
Reference in New Issue
Block a user