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.
Bookmarks