summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusinternalfilters.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-09 13:42:35 +0200
committerLars Knoll <lars.knoll@qt.io>2020-09-23 19:30:28 +0200
commit850d850c5af8ff77a4b9d53457ec6b1ba6c20cb3 (patch)
tree79af5853f71ca977c4e24eab609c0f07dcb04a7a /src/dbus/qdbusinternalfilters.cpp
parentbe714154fa3f9dd7f1a44952293eee037793e383 (diff)
Use QMetaType instead of integer based type ids
Change the implementation of Qt DBus to use QMetaType directly instead of integer based type ids. Change-Id: I999023b58fa50dcc3504386467faf09874f7d2cf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusinternalfilters.cpp')
-rw-r--r--src/dbus/qdbusinternalfilters.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index 7b99cbd917..4d8d4ca254 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -348,28 +348,28 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
// we found our property
// do we have the right type?
- int id = mp.userType();
- if (!id){
+ QMetaType id = mp.metaType();
+ if (!id.isValid()){
// type not registered or invalid / void?
qWarning("QDBusConnection: Unable to handle unregistered datatype '%s' for property '%s::%s'",
mp.typeName(), mo->className(), property_name.constData());
return PropertyWriteFailed;
}
- if (id != QMetaType::QVariant && value.userType() == QDBusMetaTypeId::argument()) {
+ if (id.id() != QMetaType::QVariant && value.metaType() == QDBusMetaTypeId::argument()) {
// we have to demarshall before writing
QVariant other{QMetaType(id)};
if (!QDBusMetaType::demarshall(qvariant_cast<QDBusArgument>(value), other.metaType(), other.data())) {
qWarning("QDBusConnection: type `%s' (%d) is not registered with QtDBus. "
"Use qDBusRegisterMetaType to register it",
- mp.typeName(), id);
+ mp.typeName(), id.id());
return PropertyWriteFailed;
}
value = other;
}
- if (mp.userType() == qMetaTypeId<QDBusVariant>())
+ if (mp.metaType() == QMetaType::fromType<QDBusVariant>())
value = QVariant::fromValue(QDBusVariant(value));
// the property type here should match
@@ -456,10 +456,10 @@ static QVariantMap readAllProperties(QObject *object, int flags)
continue;
// is it a registered property?
- int typeId = mp.userType();
- if (!typeId)
+ QMetaType type = mp.metaType();
+ if (!type.isValid())
continue;
- const char *signature = QDBusMetaType::typeToSignature(typeId);
+ const char *signature = QDBusMetaType::typeToSignature(type);
if (!signature)
continue;