问题:
Hi!
I have a small problem concerning two threads and signals/slots connected between them.
My connect looks like this.
-
...
-
...
If the signal is being emitted, I get this error:
-
(Make sure 'QVector<QVector<int> >' is registered usingqRegisterMetaType ( ). )
Also note that I have my sig/slots with a reference, but if I used a connect like this:
I’m getting this:
Object::connect: No such signal dataChanged(QVector<QVector<int> >&)
Sender
Receiver
How can I achieve a connection, do I need to put Q_DECLARE_METATYPE somewhere?
Thanks for your help!
解决方法:
-
// ...
-
qRegisterMetaType <MyArray > ( "MyArray" ) ;
-
// ...
-
connect (
-
this , SIGNAL (blurbDone2 (MyArray ) ) ,
-
this , SLOT (slotBlurb2 (MyArray ) ) ,
-
-
// with this signatures:
-
signals :
-
void blurbDone2 ( const MyArray &bb ) ;
-
-
protected slots :
-
void slotBlurb2 ( const MyArray &bb ) ;
本文讨论了在Qt中遇到的关于两个线程之间的信号与槽连接问题,特别是当使用QVector作为参数类型时遇到的错误。通过定义typedef和注册元类型,解决了信号与槽之间的连接问题。

1895

被折叠的 条评论
为什么被折叠?



