How to detach qt gui app from its parent



  • I am starting a Qt gui app using QProcess::start() call.
    When I am closing my qt app , I would like to detach it from its parent, please advice how to detach it using Qt way.

    Also when I say qApp->exit(1), in my Qt application then it takes around 3~4 seconds to terminate itself completely. What is the faster way to terminate a Qt app by itself.


  • Moderators

    QProcess::startDetached().

    As for exiting, profile your app with valgrind, you're probably using many resources that need to be cleaned and it takes time. You can kill the process, but that is not really a good way to do things.



  • Hi Thanks for your suggestion. But I am looking to detach my client process from its parent within the code of client.

    startDetached() will launch my client process as a separate process, that I dont want. I just wanted to run it as a child process only , and in some button click event of my child process I wanted to break the child-parent relationship.

    Please advice.


  • Moderators

    "Fork()":http://en.wikipedia.org/wiki/Fork_(operating_system).

    I don't think the OS will allow you to detach from within the child.


Log in to reply
 

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