i have MyClass declared as
class MyClass
{
};
Q_DECLARE_METATYPE(MyClass)
class MyClass
{
};
Q_DECLARE_METATYPE(MyClass)
To copy to clipboard, switch view to plain text mode
and this is how i establish my connections:
MyClass myclass;
qRegisterMetaType<MyClass>();
bool con;
con = connect(thread, SIGNAL(mysignal1(int)), this, SLOT(myslot1(int)), Qt::BlockingQueuedConnection);
con = connect(thread, SIGNAL(mysignal2(MyClass &)), this, SLOT(myslot2(MyClass &)), Qt::BlockingQueuedConnection);
MyClass myclass;
qRegisterMetaType<MyClass>();
bool con;
con = connect(thread, SIGNAL(mysignal1(int)), this, SLOT(myslot1(int)), Qt::BlockingQueuedConnection);
con = connect(thread, SIGNAL(mysignal2(MyClass &)), this, SLOT(myslot2(MyClass &)), Qt::BlockingQueuedConnection);
To copy to clipboard, switch view to plain text mode
i see the following in the output window:
QObject::connect: Cannot queue arguments of type
'MyClass&' (Make sure 'MyClass&' is registered using qRegisterMetaType().)
The program '[13916] testsignals.exe: Native' has exited with code 0 (0x0).
QObject::connect: Cannot queue arguments of type 'MyClass&'
(Make sure 'MyClass&' is registered using qRegisterMetaType().)
The program '[13916] testsignals.exe: Native' has exited with code 0 (0x0).
To copy to clipboard, switch view to plain text mode
maybe the issue is caused by reference?
Bookmarks