当线程启动但收到此错误时,我尝试在线程对象中调用 Slot:
Object::connect: No such slot Worker::doWork(pFoo)
线程执行代码:
// main class
m_WorkerThread = new QThread();
FooStack* pfooStack = InternalStorageManager::getInstance()->getStack();
m_Worker = new Worker();
bool done = connect(m_WorkerThread,
SIGNAL(started()),
m_Worker,
SLOT(doWork(pfooStack)));
m_Worker->moveToThread(m_WorkerThread);
m_WorkerThread->start();
// class Worker
// cpp imple
void Worker::doWork(FooStack *& rp_urlsStack)
{
}
// header
class Worker : public QObject
{
Q_OBJECT
public :
Worker();
~Worker();
public slots:
void doWork(FooStack *&);
};