Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Process started with QProcess doesn't exit if we close the main application
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    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().

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Code_ReaQtor
      wrote on last edited by
      #2

      You may try this:

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

      @void yourwidget::closeEvent(QCloseEvent *event)
      {
      anyprocess.close();
      //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

           event->accept();
      

      }@

      Please visit my open-source projects at https://github.com/Code-ReaQtor.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved