qt - QProcess 在调用 QProcess.start() 后退出应用程序

标签 qt qprocess qtcore

我正在使用 QProcess 来运行其他程序。但是当我在调用 QProcess.start() 后退出我的应用程序时,它在调试控制台中说:

QProcess: Destroyed while process is still running.

进程结束。

但我想在关闭我的应用程序后继续运行此进程。我如何开始新流程:

QProcess p;
p.start("ssu.exe", QStringList() << "-instantinstall");

我该怎么做?

最佳答案

您需要使用QProcess::startDetached。查看文档:

If the calling process exits, the detached process will continue to live.

关于qt - QProcess 在调用 QProcess.start() 后退出应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20616846/

相关文章:

c++ - 如何使用 QProcess 在控制台窗口中启动和稍后终止 cmd.exe

python - PyQt:以编程方式创建 QT 小部件

qt - 如何在 Qt 中使用 QLabel 设置图像?

c++ - 有什么方法可以真正确保 QSplashScreen 已在屏幕上重新绘制?

c++ - Q进程: Reset working directory during runtime

linux - 如何强制 QProcess 优先级

c++ - Qt 代码问题一般可能与 C++ 有关

c++ - 将 QVector 指针作为参数传递

linux - 完全删除 Qt 环境?

c++ - QTableView 带有适用于所有字段的编辑器