problem with QtConcurrent::run
How to run:
Code:
QFuture <void> future = QtConcurrent::run(client);
error: no matching function for call to 'run(Client&, int)'
I cant find the good way to declare class Client, client(), param... , arg....
Code:
main.cpp
...
Client client;
QFuture <void> future = QtConcurrent::run(client);
....
file.h
....
{
Q_OBJECT
public:
~Client();
void start
(QString address, quint16 port
);
public slots:
void startTransfer();
private:
};
....
Re: problem with QtConcurrent::run
QtConcurrent::run() expects a function, not a class. Furthermore doing networking in a thread isn't such a good idea. The network classes of Qt are already threaded.
Re: problem with QtConcurrent::run
If you want to run a member method of a class instance, check in the documentation:
QtConcurrent::Run - using member functions