Results 1 to 10 of 10

Thread: How to detect a QProcess is started

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: How to detect a QProcess is started

    I use startDetached to start the process that will not affect my main application.
    I have try all the signal, started, finished, stateChanged... all also not working. No signal is returned.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: How to detect a QProcess is started

    Quote Originally Posted by cooler123 View Post
    I use startDetached to start the process that will not affect my main application.
    I have try all the signal, started, finished, stateChanged... all also not working. No signal is returned.
    QProcess::startDetached() is a static method, so there is no QProcess object you can connect to to receive the signal from. Use QProcess::start() instead.

  3. #3
    Join Date
    Sep 2007
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: How to detect a QProcess is started

    After i use start() to start the process, can I detached it after that?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: How to detect a QProcess is started

    Quote Originally Posted by cooler123 View Post
    After i use start() to start the process, can I detached it after that?
    No, you can't. QProcess will kill its child processes. Maybe you could someway determine the state of child process if you had its PID?

  5. #5
    Join Date
    Aug 2007
    Posts
    166
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    16
    Thanked 14 Times in 14 Posts

    Default Re: How to detect a QProcess is started

    Why you need to detach the child process? If you don't call the waitForFinished() function the child process will not block your application and you will be able to monitor it well.

  6. #6
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5
    Thanked 86 Times in 81 Posts

    Default Re: How to detect a QProcess is started

    The QProcess:startDetached function returns TRUE on success and set pid argument
    A camel can go 14 days without drink,
    I can't!!!

Similar Threads

  1. Replies: 5
    Last Post: 9th June 2008, 12:21
  2. Connecting with QProcess to an already running process
    By high_flyer in forum Qt Programming
    Replies: 7
    Last Post: 26th November 2007, 11:31
  3. Detect platform where my QT4 program is running on
    By the_bis in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2007, 13:01
  4. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 01:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.