From 90305b7aac3392f60dcce6e95c31920bc0ea79b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Thu, 30 Dec 2021 13:35:44 -0500 Subject: [PATCH] dbus: Q_DECLARE_METATYPE must be called with qRegisterMetaType<> From the documentation: To use the type T in QVariant, using Q_DECLARE_METATYPE() is sufficient. To use the type T in queued signal and slot connections, qRegisterMetaType<T>() must be called before the first connection is established. I don't really understand why it was working with Qt 5.15, but the code was not working with Qt 6, so add qRegisterMetaType to fix signals. Moreover, previous qRegisterMetaType<> in ContactModel was misplaced. https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/601 Change-Id: I309de4b980d961ac352529419f895be369a87433 --- src/contactmodel.cpp | 1 - src/dbus/metatypes.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index e0c177e3..8132178c 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -582,7 +582,6 @@ ContactModelPimpl::ContactModelPimpl(const ContactModel& linked, , behaviorController(behaviorController) , callbacksHandler(callbacksHandler) { - qRegisterMetaType<VectorMapStringString>("VectorMapStringString"); // Init contacts map if (linked.owner.profileInfo.type == profile::Type::SIP) fillWithSIPContacts(); diff --git a/src/dbus/metatypes.h b/src/dbus/metatypes.h index ab2e86eb..d04d185f 100644 --- a/src/dbus/metatypes.h +++ b/src/dbus/metatypes.h @@ -118,18 +118,31 @@ inline void registerCommTypes() { #ifndef ENABLE_LIBWRAP + qRegisterMetaType<MapStringString>("MapStringString"); qDBusRegisterMetaType<MapStringString>(); + qRegisterMetaType<MapStringInt>("MapStringInt"); qDBusRegisterMetaType<MapStringInt>(); + qRegisterMetaType<VectorMapStringString>("VectorMapStringString"); qDBusRegisterMetaType<VectorMapStringString>(); + qRegisterMetaType<MapStringMapStringVectorString>("MapStringMapStringVectorString"); qDBusRegisterMetaType<MapStringMapStringVectorString>(); + qRegisterMetaType<VectorInt>("VectorInt"); qDBusRegisterMetaType<VectorInt>(); + qRegisterMetaType<VectorUInt>("VectorUInt"); qDBusRegisterMetaType<VectorUInt>(); + qRegisterMetaType<VectorULongLong>("VectorULongLong"); qDBusRegisterMetaType<VectorULongLong>(); + qRegisterMetaType<VectorString>("VectorString"); qDBusRegisterMetaType<VectorString>(); + qRegisterMetaType<MapStringVectorString>("MapStringVectorString"); qDBusRegisterMetaType<MapStringVectorString>(); + qRegisterMetaType<VectorVectorByte>("VectorVectorByte"); qDBusRegisterMetaType<VectorVectorByte>(); + qRegisterMetaType<DataTransferInfo>("DataTransferInfo"); qDBusRegisterMetaType<DataTransferInfo>(); + qRegisterMetaType<Message>("Message"); qDBusRegisterMetaType<Message>(); + qRegisterMetaType<QVector<Message>>("QVector<Message>"); qDBusRegisterMetaType<QVector<Message>>(); dbus_metaTypeInit = true; #endif -- GitLab