bair
21st March 2009, 22:19
I am writing a program which performs some heavy calculations, so I'm exploring QtConcurrent. I've looked at the QtConcurrent Progress Dialog Example (http://doc.trolltech.com/4.5/qtconcurrent-progressdialog-main-cpp.html) and tried to use QtConcurrent::map() in the same way. Here is my code:
void MainWindow::some_member_function()
{
...
QVector<int> vector;
int iterations=int(Ntotal/1000000)+1;
for (int i = 0; i < iterations; ++i)
vector.append(i);
...
futureWatcher.setFuture(QtConcurrent::map(vector, cycle)); // <----- error
...
}
void MainWindow::cycle(int &start)
{
//lots of calculations
...
}
I'm getting this error:
mainwindow.cpp:345: error: argument of type `void (MainWindow::)(int&)' does not match `void (MainWindow::*)(int&)'
I'm confused. How should I use my member function cycle() in QtConcurrent::map() properly?
void MainWindow::some_member_function()
{
...
QVector<int> vector;
int iterations=int(Ntotal/1000000)+1;
for (int i = 0; i < iterations; ++i)
vector.append(i);
...
futureWatcher.setFuture(QtConcurrent::map(vector, cycle)); // <----- error
...
}
void MainWindow::cycle(int &start)
{
//lots of calculations
...
}
I'm getting this error:
mainwindow.cpp:345: error: argument of type `void (MainWindow::)(int&)' does not match `void (MainWindow::*)(int&)'
I'm confused. How should I use my member function cycle() in QtConcurrent::map() properly?