C++ (Qt)void runWine (QProcess *proc, QString comand){ proc->start (command);proc->waitForFinished();} void WineProcess:run(){process = new QProcess (this);//блабла, инициализирую QProcess и пр.watcher->setFuture(QtConcurrent::run (runWine, process, QString ("wine blablabla")));//присоединяю watcher к QProgressDialog, блабла}
C++ (Qt)... proc = new QProcess(); connect(proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotFinished(int,QProcess::ExitStatus)));... void MainWindow::startProcess(){ ui->textBrowser->append("Starting process..."); proc->start("/usr/bin/sleep 5");} void MainWindow::slotFinished(int, QProcess::ExitStatus){ ui->textBrowser->append("Finished process");}
C++ (Qt)void MainWindow::startProcess(){ QEventLoop loop; WaitDialog dlg; connect( &dlg, SIGNAL( canceled() ), &loop, SLOT( quit() ) ); QProcess proc; connect( &proc, SIGNAL( finished(int,QProcess::ExitStatus) ), &loop, SLOT( quit() ) ); dlg.show(); proc.start( ... ); loop.exec();}