Qt - 错误总结 - QObject::connect: Cannot queue arguments of type 'PVCI_CAN_OBJ' (Make sure 'PVCI_CAN_OBJ...

背景:一个线程通过signal-slot发送PVCI_CAN_OBJ类型的值到主线程中,

错误提示:

QObject::connect: Cannot queue arguments of type 'PVCI_CAN_OBJ'

(Make sure 'PVCI_CAN_OBJ' is registered using qRegisterMetaType().)

原因:在线程中通过signal-slot传递信息时,参数默认放到队列中的,但PVCI_CAN_OBJ是自定义的参数,不是Qt自带的参数结构。

解决方法:

将不识别的参数结构进行注册,让Qt能够识别。

 包含头文件

#include 

在构造函数中调用其方法完成注册:
qRegisterMetaType("PVCI_CAN_OBJ");//注册PVCI_CAN_OBJ类型

转载于:https://www.cnblogs.com/Pan-Z/p/6223440.html

你可能感兴趣的:(Qt - 错误总结 - QObject::connect: Cannot queue arguments of type 'PVCI_CAN_OBJ' (Make sure 'PVCI_CAN_OBJ...)