show progress QFutureWatcher connected to QProgressBar

111 Views Asked by At

I have a QFutureWatcher connected to a QProgressBar, the code is running but never show me the progress of the progressBar

QProgressDialog progress;
QFutureWatcher<void> watcher;

connect(&watcher, SIGNAL(finished()),&progress, SLOT(reset()));
connect(&watcher, SIGNAL(progressRangeChanged(int, int)),&progress, SLOT(setRange(int,int)));
connect(&watcher, SIGNAL(progressValueChanged()),&progress, SLOT(setValue(int)));
QFuture<int> file = QtConcurrent::run(aFunction, cmd);
watcher.setFuture(file);
progress.exec();
watcher.waitForFinished();
int aFunction(string cmd){
  int status;
  status= system(cmd.c_str());
  return status;
}

this is the code I have, the result just show me a full progress bar, I want to see from 0 to 100 enter image description here

0

There are 0 best solutions below