Skip to content
  • 0 Votes
    16 Posts
    6k Views
    L

    same issue i have came across; see my post:
    https://forum.qt.io/topic/122640/qvideoprobe-stop-working-when-processing-time-is-long/11

  • 0 Votes
    6 Posts
    2k Views
    mrjjM

    @nulluse
    hi
    you should only need in .h
    if cpp.cc file does include that .h

  • 0 Votes
    5 Posts
    1k Views
    Q

    Thanks. I used your code to construct the thing below. It looks not so hot but work just how I need.

    // call this function to start void MainWindow::on_btn_iter_clicked() { maxIter = 5; s = fieldSizeI / threadsAmount; NewIteration(); } void MainWindow::NewIteration() { std::vector<QFutureWatcher<void> *> watchers (threadsAmount); for (size_t i = 0; i < threadsAmount; ++i) { watchers[i] = new QFutureWatcher<void>; connect (watchers[i], SIGNAL (finished()), this, SLOT (S())); } typedef std::vector<QFuture<void> > futures (threadsAmount); for (size_t i = 0; i < threadsAmount; ++i) { futures[i] = QtConcurrent::run(field, &CA_Field::PerformIteration, i*s, (i+1)*s ); watchers[i]->setFuture(futures[i]); } } void MainWindow::S() { ++workCounter; if (workCounter == threadsAmount) { field->AdoptNewState(); workCounter = 0; (--maxIter != 0) ? NewIteration() : UpdateHexMap(); } }