QEventLoop loop; QFutureWatcher<void> watcher; connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit())); QFuture<void> future = QtConcurrent::run(this, &MyClass::MyMethod, parameters...); watcher.setFuture(future); loop.exec();
0 ntdll!LdrDestroyOutOfProcessImage C:\WINDOWS\system32\ntdll.dll 0 0x7c8285f3 1 ntdll!LdrAddRefDll C:\WINDOWS\system32\ntdll.dll 0 0x7c82860c 2 ntdll!ZwClose C:\WINDOWS\system32\ntdll.dll 0 0x7c826d49 3 ?? C:\WINDOWS\system32\vfbasics.dll 0 0x00392f52 4 ?? 0 0x00000000
ui->errorEdit->append(s);иprogressBar->setValue(i * 100 / cycles);
I solved my task himself, with signals and slots and using QtConcurrent::run().
QEventLoop loop; QFutureWatcher<QString> watcher; connect(&watcher, SIGNAL(finished()), &loop, SLOT(quit())); // Prepare cycles vector QVector<int> vector; for (int i = 0; i < cyclesCount; i++) vector.append(i); // Run thread watcher.setFuture(QtConcurrent::mapped(vector, &MyClass::MyMethod));