HumbleFish

导航

QT 信号与槽 中传递自定义数据类型

  使用QT 的信号与槽函数的过程,编译完成后,在运行程序是出现如下信息:

QObject::connect: Cannot queue arguments of type 'myReadBuf'
(Make sure 'myReadBuf' is registered using qRegisterMetaType().)

 

解决方法:这是由于myReadBuf 是自定义的数据类型,系统不能很好的解析他。只需要在 使用connect的类的构造函数中加入如下代码即可:

   qRegisterMetaType<myReadBuf>("myReadBuf");//注册myReadBuf类型

posted on 2021-06-10 19:43  HumbleFish  阅读(184)  评论(0编辑  收藏  举报