"Cannot queue arguments of type" even after call qRegisterMetaType()
Unsolved
General and Desktop
-
I need to use signal/slot to transmit data from a QThread to the main thread, the data is of type QMap<int, QVector<MyType>>.
I use a typedef to describe the data structure:typedef QMap<int, QVector<MyType>> CompType;
And I try to register it almost everywhere, including in the constructor of the QThread
MyThread::MyThread() { qRegisterMetaType<CompType>("CompType"); }
and in the constructor of the class in which start the thread
ThreadStarter::ThreadStarter() { qRegisterMetaType<CompType>("CompType"); }
even in the main() function
int main(int argc, char *argv[]) { qRegisterMetaType<CompType>("CompType"); QCoreApplication::addLibraryPath("./"); QApplication a(argc, argv); PointAnalysis w; w.show(); return a.exec(); }
But when I emit a signal at the end of thread run()
CompType data; /* Fill in the data */ emit threadDone(data);
There is a such line in the Debug log:
QObject::connect: Cannot queue arguments of type 'Part_Candidates'
(Make sure 'Part_Candidates' is registered using qRegisterMetaType().)The signal and the slot are connect just below the thread is created, and I'm sure the parameters of them are definately the same as CompType.
Anyone can tell me what to do?