如果我使用startDetached启动QProcess,是否可以获得完整的插槽 [英] Do I get a finished slot if I start QProcess using startDetached
问题描述
如果使用startDetached()启动QProcess,是否会收到完成信号?我正在尝试启动一个过程,但是我需要能够在该过程终止时获得一个事件。
Do I get a finished signal if I start a QProcess using startDetached()? I'm trying to start a process, but I need to be able to get an event when the process has terminated.
推荐答案
不,当您使用startDetached时,您会收到信号,因为您没有对象。
No you can't get a signal when you use startDetached because you have no object.
startDetached是静态函数,当您调用它时,该过程将直接启动而无需创建一个QProcess对象。因此,即使有信号,您也无法将其连接到任何东西,因为您没有对象可以连接。
startDetached is a static function and when you call it the process is started directly without creating a QProcess object. Therefore, even if there was a signal you would not be able to connect it to anything since you have no object to connect from.
如果您想要一个信号,则应该创建一个一个QProcess对象,然后对其调用start。然后,您将能够在流程完成时获得完成信号。
If you want a signal you should create a QProcess object and then call start on it. You will then be able to get the finished signal when the process finishes.
这篇关于如果我使用startDetached启动QProcess,是否可以获得完整的插槽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!