Qt Mobility / Service Framework / complex parameters, structures

  • Hello all,

    I simply want to declare a service with a parameter of complex type (like a structure for example). I am working with remote services, to perform basic IPC.

    When the service is called, it sends a signal in return with a parameter to the client. If this parameter is a simple type parameter like int for instance, the signal is correctly received by the client (the client is making a connection with the service signal).
    If I introduce a struct parameter instead of the int parameter, then the client is never receiving the signal.

    Do somebody know what I have to do so that my struct is correctly sent through the Qt Mobility Service Framework?

    I even tried to declare my structure as a metatype to see if this helps, but it led to a segmentation fault!
    The following code illustrate the segmentation fault case:
    #include <QObject>
    #include <QtCore/QMetaType>

    struct t_monstruct {
    t_monstruct() : a(0), b(0) {}
    t_monstruct (const t_monstruct &other)
    a(other.a), b(other.b)

    int a;
    int b;

    } ;


    In the server.h:
    #include "structure.h"
    class CServer
    void sgnInitialize(t_monstruct id)
    in the server.cpp
    in the service slot method ()

        t_monstruct id;
        id.a = 10;
        id.b = 50;
        //returns a signal when the slot is called
        emit sgnInitialize(id);

    In the client.cpp

         CClient::sgnInitializelocal(t_monstruct id)
             qDebug()<<id.a<<" "<<is.b;


    Thank you,

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.