diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp index 0d59efe145..4f749b0f9d 100644 --- a/src/dbus/qdbusabstractadaptor.cpp +++ b/src/dbus/qdbusabstractadaptor.cpp @@ -305,7 +305,7 @@ void QDBusAdaptorConnector::relay(QObject *senderObj, int lastSignalIdx, void ** realObject = realObject->parent(); // break down the parameter list - QList types; + QList types; QString errorMsg; int inputCount = qDBusParametersForMethod(mm, types, errorMsg); if (inputCount == -1) { diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp index 4c580ed676..0a873ad5ad 100644 --- a/src/dbus/qdbusabstractinterface.cpp +++ b/src/dbus/qdbusabstractinterface.cpp @@ -154,10 +154,10 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu if (!isValid || !canMakeCalls()) // can't make calls return false; - const int type = mp.userType(); + QMetaType type = mp.metaType(); // is this metatype registered? const char *expectedSignature = ""; - if (int(mp.userType()) != QMetaType::QVariant) { + if (type.id() != QMetaType::QVariant) { expectedSignature = QDBusMetaType::typeToSignature(type); if (expectedSignature == nullptr) { qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be " @@ -193,10 +193,10 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu const char *foundType = nullptr; QVariant value = qvariant_cast(reply.arguments().at(0)).variant(); - if (value.userType() == type || type == QMetaType::QVariant + if (value.metaType() == type || type.id() == QMetaType::QVariant || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) { // simple match - if (type == QMetaType::QVariant) { + if (type.id() == QMetaType::QVariant) { *reinterpret_cast(returnValuePtr) = value; } else { QMetaType(type).destruct(returnValuePtr); @@ -205,7 +205,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu return true; } - if (value.userType() == qMetaTypeId()) { + if (value.metaType() == QMetaType::fromType()) { QDBusArgument arg = qvariant_cast(value); foundType = "user type"; @@ -216,7 +216,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu } } else { foundType = value.typeName(); - foundSignature = QDBusMetaType::typeToSignature(value.userType()); + foundSignature = QDBusMetaType::typeToSignature(value.metaType()); } // there was an error... @@ -281,7 +281,7 @@ int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void if (_c == QMetaObject::WriteProperty) { QVariant value; - if (mp.userType() == qMetaTypeId()) + if (mp.metaType() == QMetaType::fromType()) value = reinterpret_cast(_a[0])->variant(); else value = QVariant(mp.metaType(), _a[0]); diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp index 840a6d9673..10baa5d907 100644 --- a/src/dbus/qdbusargument.cpp +++ b/src/dbus/qdbusargument.cpp @@ -96,7 +96,7 @@ QByteArray QDBusArgumentPrivate::createSignature(int id) "(Did you forget to call beginStructure() ?)", QMetaType(id).name(), signature.constData(), - QMetaType(QDBusMetaType::signatureToType(signature)).name()); + QDBusMetaType::signatureToMetaType(signature).name()); return ""; } return signature; @@ -879,7 +879,7 @@ void QDBusArgument::endStructure() \sa endArray(), beginStructure(), beginMap() */ -void QDBusArgument::beginArray(int id) +void QDBusArgument::beginArray(QMetaType id) { if (QDBusArgumentPrivate::checkWrite(d)) d = d->marshaller()->beginArray(id); @@ -916,10 +916,10 @@ void QDBusArgument::endArray() \sa endMap(), beginStructure(), beginArray(), beginMapEntry() */ -void QDBusArgument::beginMap(int kid, int vid) +void QDBusArgument::beginMap(QMetaType keyMetaType, QMetaType valueMetaType) { if (QDBusArgumentPrivate::checkWrite(d)) - d = d->marshaller()->beginMap(kid, vid); + d = d->marshaller()->beginMap(keyMetaType, valueMetaType); } /*! diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index 721ac41b3c..cf09543912 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -103,9 +103,13 @@ public: void beginStructure(); void endStructure(); - void beginArray(int elementMetaTypeId); + void beginArray(int elementMetaTypeId) + { beginArray(QMetaType(elementMetaTypeId)); } + void beginArray(QMetaType elementMetaType); void endArray(); - void beginMap(int keyMetaTypeId, int valueMetaTypeId); + void beginMap(int keyMetaTypeId, int valueMetaTypeId) + { beginMap(QMetaType(keyMetaTypeId), QMetaType(valueMetaTypeId)); } + void beginMap(QMetaType keyMetaType, QMetaType valueMetaType); void endMap(); void beginMapEntry(); void endMapEntry(); @@ -165,8 +169,7 @@ template inline T qdbus_cast(const QDBusArgument &arg) template inline T qdbus_cast(const QVariant &v) { - int id = v.userType(); - if (id == qMetaTypeId()) + if (v.metaType() == QMetaType::fromType()) return qdbus_cast(qvariant_cast(v)); else return qvariant_cast(v); @@ -227,8 +230,7 @@ template