Qt 多线程信号和槽——自定义参数传递

需求:想要使用信号传递double数组

定义信号: 

void signal_double(QList<double>);

编译&运行:

Object::connection: Cannot queue arguments of type 'QList<double>'

(Make sure 'QList<double>' is registered using qRegisterMetaType().))

原因:

  自定义的数据类型作为信号槽参数传递的时候,需要使用 qRegisterMetaType() 函数对该参数进行注册

解决:

1、添加头文件 #include <QMetaType>

2、注册 qRegisterMetaType<QList<double> > ("QList<double>");

3、注意:在哪儿连接信号和槽,在哪儿注册。

参考:http://blog.csdn.net/kusey/article/details/7995815

 
原文地址:https://www.cnblogs.com/shuoguoleilei/p/11686298.html