67 |
67 |
68 // Create a progress dialog. |
68 // Create a progress dialog. |
69 QProgressDialog dialog; |
69 QProgressDialog dialog; |
70 dialog.setLabelText(QString("Progressing using %1 thread(s)...").arg(QThread::idealThreadCount())); |
70 dialog.setLabelText(QString("Progressing using %1 thread(s)...").arg(QThread::idealThreadCount())); |
71 |
71 |
72 // Create a QFutureWatcher and conncect signals and slots. |
72 // Create a QFutureWatcher and connect signals and slots. |
73 QFutureWatcher<void> futureWatcher; |
73 QFutureWatcher<void> futureWatcher; |
74 QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); |
74 QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); |
75 QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); |
75 QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); |
76 QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); |
76 QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); |
77 QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); |
77 QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); |