Qt QProces的使用
start() ,execute() 存在進程的阻塞, QProcess 對象進程等待干活中的另外一個進程
startDetach() ,使第二個進程自己單獨跑創作中心
void SoftWareUpdate::startNewApp()
{
? ? m_label->setText("update complete. start to start the new App...");
? ? // kill
? ? QProcess p;
? ? p.setWorkingDirectory(APP_DIR);
? ? p.start("killall App");
? ? p.waitForStarted(10);
? ? qDebug() << p.state();
? ? // start App
? ?p.waitForFinished();
? ?p.start("cd ./App/"); ? ? ? ? ? ?// start will mute the main process
? ?p.start("chmod 777 App");
? ?p.waitForFinished();
? ?p.start("./App/App");
? ?p.waitForFinished();
? ? qDebug() << "this is the work dir:" <<p.workingDirectory();
? ?p.waitForStarted();
? ?qDebug() << " the start error:" << p.error();
}
總結
以上是生活随笔為你收集整理的Qt QProces的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 构建之法与博客首秀
- 下一篇: CentOS7入门:使用Vi文本编辑器