PDA

View Full Version : QtConcurrent::run() with function member?



wookoon
8th July 2010, 10:33
I can't seem to be able to associate QtConcurrent::run() with a method (function member of a class) only with a simple function. How can I do this.



... ...
QVector<double> MyClass::execute(QModelIndex index,QVector<double> args)
{
..........
}

QVector<double> MyClas::caculator(QModelIndex index,QVector<double> args)
{
QFuture<QVector<double> > future = QtConcurrent::run(&MyClas::execute,index,args);
...........


error: no matching function for call to 'run(<unresolved overloaded function type>, QModelIndex&, QVector<double>&)'

Lesiok
8th July 2010, 12:08
And how with :

QFuture<QVector<double> > future = QtConcurrent::run(this->execute,index,args);

wookoon
8th July 2010, 12:15
And how with :

QFuture<QVector<double> > future = QtConcurrent::run(this->execute,index,args);
I have try this way, and it show the same error.

Lesiok
8th July 2010, 13:12
Just read carefully this docs (http://doc.trolltech.com/4.6/qtconcurrentrun.html). Here are examples how to run static and non static member functions.