Important: Please read the Qt Code of Conduct -

Serialize application types as QVariant with IPC

  • Hello all!

    I am currently working on several applications, communicating by IPC (QLocalSocket). The messages exchanged between the application are serialized in a QVariantHash (by design). In this hash, I have to transmit an internal type, let's say of class InternalType.

    The first app (client side) encodes the message as a QVariantHash with an entry with a value of type 'InternalType'. This app correctly registered the InternalType.

    The second app (server side) receives the message, and its aim is just to resend the message to a third app. So, this app doesn't have to know the exact type of InternalType. However, if the type InternalType is not registered using qRegisterMetaType<InternalType>(...), the reception of the message sent by the first app results as an empty QVariantHash.

    I would like to avoid to register a specific type in every applications that doesn't have to know it explicitly.

    Thank you in advance for your answers!