72 |
72 |
73 // Create a QFutureWatcher and conncect signals and slots. |
73 // Create a QFutureWatcher and conncect signals and slots. |
74 QFutureWatcher<void> futureWatcher; |
74 QFutureWatcher<void> futureWatcher; |
75 QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); |
75 QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); |
76 QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); |
76 QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); |
77 QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int, int)), &dialog, SLOT(setRange(int, int))); |
77 QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); |
78 QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); |
78 QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); |
79 |
79 |
80 // Start the computation. |
80 // Start the computation. |
81 futureWatcher.setFuture(QtConcurrent::map(vector, spin)); |
81 futureWatcher.setFuture(QtConcurrent::map(vector, spin)); |
82 |
82 |