Qt의 qtconcurrentmap을 사용하여 일부 이미지를 처리하려고하는데 다음 오류가 발생합니다.'void (ClassName ::) (QString &)'형식의 인수가 'void (ClassName :: *) (QString &)'와 일치하지 않습니다.
argument of type 'void (ClassName::)(QString&)' does not match 'void (ClassName::*)(QString&)
나는 또한 내 코드
void ClassName::processImage(QString &f)
{
Image image;
image.read(qPrintable(f));
try {
//Apply effects on an Image
} catch (Magick::Exception & error) {
// Displaying any possible errors on the text browser
ui->textBrowser_error->setText(error.what());
}
}
void ClassName::processAll() {
foreach (QFileInfo f, list)
{ QString str(f.absoluteFilePath());
QList<QString> listof;
listof.append(str);
}
QFuture<void> future = QtConcurrent::map(listof, processImage);
}
어떤 아이디어
/Library/Frameworks/QtCore.framework/Headers/qtconcurrentmapkernel.h::
In member function 'bool QtConcurrent::MapKernel<Iterator, MapFunctor>::runIteration(Iterator, int, void*)
[with Iterator = QList<QString>::iterator, MapFunctor = void (ClassName::*)(QString&)]':
/Library/Frameworks/QtCore.framework/Headers/qtconcurrentmapkernel.h:73:
error: must use '.*' or '->*' to call pointer-to-member function in
'((QtConcurrent::MapKernel<QList<QString>::iterator, void (ClassName::*)(QString&)>*)this)->QtConcurrent::MapKernel<QList<QString>::iterator, void (ClassName::*)(QString&)>::map (...)'
을이되어지고있어?
어떻게 내가 그것을 놓칠 수 있었느냐? 대단한 답변! 두 번째 오류에 대한 아이디어가 있습니까? 나는 아직도 그것을 얻고있다 – Sharethefun
나는 그렇게 생각한다. 문서를 보면,'map' 메쏘드는 함수를 두번째 매개 변수로 기대합니다. 이것을 위해 멤버 함수를 사용하려면 boost :: bind' :'boost :: bind (& ClassName :: processImage, this)'가 필요합니다. –
그레이트 디에고, 왜 당신이 6 표를 가지고 있는지 궁금하지 않습니다! 나는이 오류가 발생하고 나는 boost 라이브러리를 사용하지 않기 때문에 짐작한다. 오류 : 'boost'가 선언되지 않았다. 아니야? – Sharethefun