Process started with QProcess doesn't exit if we close the main application

  • Suppose i start a process in terminal in Linux, if the terminal is closed the child process started in terminal also exits. But if i start a process (say) p1 using QProcess inside a GUI application, and then close the gui application, process p1 still keeps running, as if it is a daemon, even if i don't start the process using QProcess::startDetached().

  • You may try this:

    reimplement the protected function:
    void closeEvent(QCloseEvent *event);@

    @void yourwidget::closeEvent(QCloseEvent *event)
    //from void QProcess::close () [virtual] - documentation
    //Closes all communication with the process and kills it. After calling this function, QProcess
    //will no longer emit readyRead(), and data can no longer be read or written



Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.