Checking whether qprocess has finished
问题 I have to check whether my process has finished and I need to convert it to bool because I want to you if. In MainWindow.h I have created an object QProcess *action; In mainwindow.cpp void MainWindow:: shutdown() { action=new QProcess(this); action->start("shutdown -s -t 600"); //and now I want to use if if (action has finished) { QMessageBox msgBox; msgBox.setText("Your computer will shutdown in 1 minute."); msgBox.exec(); } 回答1: You should connect to the process's finished signal. Your code