I am calling a process in a loop. Need to ensure that one process ends before it starts again. how is it possible.
    void MainWindow::setNewProjectInQueueList()
{
//  this is already gotten in queueList now loop thru the list and add project
    QStringList arguments;
    projNm = ui->lineEditCreateProject-&开发者_如何转开发gt;text();
    qDebug() << " projNm " << projNm;
    for (int j= 0; j < queueList.length(); j++)
    {   if (! QString(queueList[j]).isEmpty())
        {
//          call process
//          QString queueName = queueList[j];
            arguments << "-sq" << queueList[j];
            qDebug() << " arguments sq " << queueList[j];
            procQueueList.start("qconf",arguments);
        }
    }
//  and append for each queue with new project name
//  and store into the system
}
Brgds,
kNish
Call QProcess::waitForFinished() to wait until the process terminates.
Using the waitForFinished approach from within a loop in the main thread will freeze the application. Instead, putting the loop in a separate thread, or making a queue of processes to start and then launch upon the finished signal from the previous one is good alternatives.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论