部首:
#include <controller_thread.h>
Worker::Worker(){}
Worker::~Worker(){}
void Worker::calculateImage()
{
}
Controller::Controller()
{
objWorker.moveToThread( &objQThread );
connect( objWorker, objWorker::imageReady, this, receiveImage );
objQThread.start();
}
Controller::~Controller(){}
void Controller::receiveImage()
{
}
来源:
error: ‘objWorker’ is not a class, namespace, or enumeration
connect( objWorker, objWorker::imageReady, this, receiveImage );
^
我收到错误:
connect( objWorker, &Worker::imageReady, this, &Controller::receiveImage );
这个错误是什么意思?如何解决?
打字:
error: no matching function for call to ‘Controller::connect(Worker&, void (Worker::*)(), Controller*, void (Controller::*)())
结果:
Job.joins(:job_categories).joins(:categories).where('lower(categories.parent) LIKE lower(?)', "%#{params[:parent]}%").distinct
答案 0 :(得分:2)
错误在这一行:
connect( objWorker, objWorker::imageReady, this, receiveImage );
在'新'Qt5语法中,您需要在此处提供类名而不是对象名 - objWorker::imageReady
。
所以,你的连接语句应该是这样的:
connect( objWorker, &Worker::imageReady, this, &Controller::receiveImage );
有关“新”Qt5连接语法的更多帮助,请参阅here