被发送自定义对象:
spotMethod 由emit 发送 需要注册该自定义类
spotMethod() {
//qRegisterMetaType<spotMethod>("spotMethod");
}
spotMethod(const spotMethod& sp) {// 否则使用qRegisterMetaType会报错
//qRegisterMetaType<spotMethod>("spotMethod");
}
在主线程的构造函数使用qRegisterMetaType 记得添加头文件
#include <QMetaType>