Results 1 to 1 of 1

Thread: Qt & External Threaded API

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qt & External Threaded API

    I am creating a Qt project, however one of the requires for this project is that I NOT use Qt Socket communication.
    The API that I am asked to use for the Socket Communication is a thread safe API.

    Although the project compiles, in the logs it shows "QObject::connect: Cannot queue arguments of type MyStructure

    struct MyStructure
    {
    SubStructure a;
    int b;
    };

    struct SubStructure
    {
    int c;
    double d;
    };
    NOTE: = operators are defined for ALL structs

    I've tried using Q_DECLARE_METATYPE, but I end up with the following compilation errors:

    MyEnumerationType.h : errors expected constructor, destructor, or type conversion before namespace.

    MyEnumeration is a attribute of a COMPLETELY different structure.


    The API works as follows:
    I create a message service, and add a list of structures to the service. For structures that I will be SENDING only, I need not do anything additional. However for structures I expect a response for, I MUST provide the service with a Callback class, which "handles" the message.

    class GuiMessageCallback : public QObject,
    public MessageCallback
    {
    public:
    GuiMessageCallback(){};

    MessageData( [Struct] msg& )
    {
    Q_EMIT messageReceived( msg )
    }

    Q_SIGNALS:
    void messageReceived( Struct]);
    };

    When the Callback message is "feed" into the external API, a pointer reference is kept and in QTableModel class, which I connect it to a SLOT which updates my model and therefore updates my views.

    Thanks,
    Mr. eyfout


    Added after 34 minutes:


    Problem fixed.
    I first call qRegisterMetaType< MyType> ( "MyType") prior to performing the connection between the SIGNALS and SLOTS on different threads.

    I removed the Q_DECLARE_METATYPE( ) references also.
    Last edited by mreyfout; 28th October 2010 at 22:39.

Similar Threads

  1. access to ui in a threaded application
    By mastupristi in forum Qt Programming
    Replies: 3
    Last Post: 17th June 2010, 10:31
  2. Write to Threaded Server
    By Suncell in forum Newbie
    Replies: 17
    Last Post: 9th June 2010, 19:46
  3. Threaded List-operations
    By soul_rebel in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2010, 12:24
  4. Threaded TCP server
    By Sysace in forum Newbie
    Replies: 4
    Last Post: 21st February 2008, 12:37
  5. Threaded server.
    By nithinin2001 in forum Qt Programming
    Replies: 2
    Last Post: 15th November 2007, 16:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.