I have a recursive directory copy function I'd like to run in the background. The function takes two QString arguments, filepath and dir.
From .pro:
QT += core gui sql network concurrent
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
LIBS += -lQt5Concurrent
From code:
#include <QtConcurrent/QtConcurrent>
#include <qtconcurrentrun.h>
#include <QThread>
...
QFuture <void> future = QtConcurrent::run(copyFolder(filepath,dir));
I get the following compile error:
error: no matching function for call to 'run'
QFuture <void> future = QtConcurrent::run(copyFolder(filepath,dir) );
^~~~~~~~~~~~~~~~~
If I call the function like this:
QFuture <void> future = QtConcurrent::run(copyFolder, filepath,dir );
error: reference to non-static member function must be called
QFuture <void> future = QtConcurrent::run(copyFolder, filepath,dir );
^~~~~~~~~~
What am I doing wrong?