jeudi 8 juin 2017

Passing pointer to a function with parameters as parameter

I have code, where I need to implement passing pointer to a function with an argument, like in code below, but it doen't seems to be possible.

bool StudentAbsenceTableApp::loadFile(const QString &fileName)
{
    fw.moveToThread(this->thread());
    fw.setParent(this);
    //I need: &(StudentAbsenceTableApp::experimentFunction(fileName)
    QFuture<bool> future =  QtConcurrent::run(this, &StudentAbsenceTableApp::experimentFunction);
    fw.setFuture(future);

    progressBar->show();
}
// I need: experimentFunction(const QString& fileName)
bool StudentAbsenceTableApp::experimentFunction()
{
    QString fileName = "/media/bsuir/data.xml";
    XMLParser *xmlParser = new XMLParser(model);

    xmlParser->read(fileName);
    setCurrentFileName(fileName);
    statusBar()->showMessage(tr("Файл загружен"), 2000);
    documentModified = false;

    return true;
}

But there are no ways, I could find.

Aucun commentaire:

Enregistrer un commentaire