I am writing a program which performs some heavy calculations, so I'm exploring QtConcurrent. I've looked at the QtConcurrent Progress Dialog Example and tried to use QtConcurrent::map() in the same way. Here is my code:
Qt Code:
  1. void MainWindow::some_member_function()
  2. {
  3. ...
  4. QVector<int> vector;
  5. int iterations=int(Ntotal/1000000)+1;
  6. for (int i = 0; i < iterations; ++i)
  7. vector.append(i);
  8. ...
  9. futureWatcher.setFuture(QtConcurrent::map(vector, cycle)); // <----- error
  10. ...
  11. }
  12. void MainWindow::cycle(int &start)
  13. {
  14. //lots of calculations
  15. ...
  16. }
To copy to clipboard, switch view to plain text mode 
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?