Skip to content
Snippets Groups Projects
Commit 90305b7a authored by Sébastien Blin's avatar Sébastien Blin
Browse files

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.

jami-client-qt#601

Change-Id: I309de4b980d961ac352529419f895be369a87433
parent af653f14
No related branches found
No related tags found
No related merge requests found
...@@ -582,7 +582,6 @@ ContactModelPimpl::ContactModelPimpl(const ContactModel& linked, ...@@ -582,7 +582,6 @@ ContactModelPimpl::ContactModelPimpl(const ContactModel& linked,
, behaviorController(behaviorController) , behaviorController(behaviorController)
, callbacksHandler(callbacksHandler) , callbacksHandler(callbacksHandler)
{ {
qRegisterMetaType<VectorMapStringString>("VectorMapStringString");
// Init contacts map // Init contacts map
if (linked.owner.profileInfo.type == profile::Type::SIP) if (linked.owner.profileInfo.type == profile::Type::SIP)
fillWithSIPContacts(); fillWithSIPContacts();
......
...@@ -118,18 +118,31 @@ inline void ...@@ -118,18 +118,31 @@ inline void
registerCommTypes() registerCommTypes()
{ {
#ifndef ENABLE_LIBWRAP #ifndef ENABLE_LIBWRAP
qRegisterMetaType<MapStringString>("MapStringString");
qDBusRegisterMetaType<MapStringString>(); qDBusRegisterMetaType<MapStringString>();
qRegisterMetaType<MapStringInt>("MapStringInt");
qDBusRegisterMetaType<MapStringInt>(); qDBusRegisterMetaType<MapStringInt>();
qRegisterMetaType<VectorMapStringString>("VectorMapStringString");
qDBusRegisterMetaType<VectorMapStringString>(); qDBusRegisterMetaType<VectorMapStringString>();
qRegisterMetaType<MapStringMapStringVectorString>("MapStringMapStringVectorString");
qDBusRegisterMetaType<MapStringMapStringVectorString>(); qDBusRegisterMetaType<MapStringMapStringVectorString>();
qRegisterMetaType<VectorInt>("VectorInt");
qDBusRegisterMetaType<VectorInt>(); qDBusRegisterMetaType<VectorInt>();
qRegisterMetaType<VectorUInt>("VectorUInt");
qDBusRegisterMetaType<VectorUInt>(); qDBusRegisterMetaType<VectorUInt>();
qRegisterMetaType<VectorULongLong>("VectorULongLong");
qDBusRegisterMetaType<VectorULongLong>(); qDBusRegisterMetaType<VectorULongLong>();
qRegisterMetaType<VectorString>("VectorString");
qDBusRegisterMetaType<VectorString>(); qDBusRegisterMetaType<VectorString>();
qRegisterMetaType<MapStringVectorString>("MapStringVectorString");
qDBusRegisterMetaType<MapStringVectorString>(); qDBusRegisterMetaType<MapStringVectorString>();
qRegisterMetaType<VectorVectorByte>("VectorVectorByte");
qDBusRegisterMetaType<VectorVectorByte>(); qDBusRegisterMetaType<VectorVectorByte>();
qRegisterMetaType<DataTransferInfo>("DataTransferInfo");
qDBusRegisterMetaType<DataTransferInfo>(); qDBusRegisterMetaType<DataTransferInfo>();
qRegisterMetaType<Message>("Message");
qDBusRegisterMetaType<Message>(); qDBusRegisterMetaType<Message>();
qRegisterMetaType<QVector<Message>>("QVector<Message>");
qDBusRegisterMetaType<QVector<Message>>(); qDBusRegisterMetaType<QVector<Message>>();
dbus_metaTypeInit = true; dbus_metaTypeInit = true;
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment