Results 1 to 9 of 9

Thread: QProcess timeout

  1. #1
    Join Date
    Apr 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Lightbulb QProcess timeout

    Hy everybody

    I have a litlle problem, I would like to lauch an extern scrip using QProcess, and I would like to have a timeout.

    But I couldn't use the waitForTimeout() methode, I need to use the Signal/slot.

    My question is, if it have a possibility to set a timeout to the QProcess without using the method waitForTimeout() ?

    Thank's


  2. #2
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QProcess timeout

    Check out the SIGNLAS of QProcess. There is a signal called finished(...) where you can get the exitcode and QProcess::ExitStatus too.

  3. #3
    Join Date
    Apr 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QProcess timeout

    Yes i have readed it, but i would like to put a timeout to my process, different to the default timeout of QProcess. Then, when this timeout occure, QProcess send me the signal finished.

    But the main problem is how to change the default timeout of QProcess without using waitForTimedout() ?

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess timeout

    And how about waitForFinished ?

  5. #5
    Join Date
    Apr 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QProcess timeout

    No, I couldn't use any method waitFor...

    No have possibility ?

  6. #6
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess timeout

    What mean "I couldn't use any method waitFor..." ? Why ?
    PS.
    I think that You must use extra QTimer to generate timeout.

  7. The following user says thank you to Lesiok for this useful post:

    MonkeyJLuffy (22nd April 2010)

  8. #7
    Join Date
    Apr 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QProcess timeout

    It mean that the restriction of this program no let me use any "wait" that suspend the program

    The timeout that i want is 300'000 ms and the default is 30'000, then the QTimer don't resolve my problem

    Any other solucion ?

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess timeout

    Create a QTimer, connect its timeout() signal to some slot and when the slot fires you will know the process timed out and you can kill it. If you receive the finished() signal before the timer times out you can stop the timer.

  10. The following user says thank you to wysota for this useful post:

    MonkeyJLuffy (22nd April 2010)

  11. #9
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess timeout

    About what timeout You are talking ?
    Just do like Wysota and me suggest.

Similar Threads

  1. Networking: QTcpSocket timeout
    By weaver4 in forum Qt Programming
    Replies: 7
    Last Post: 28th February 2010, 22:10
  2. QHttp Timeout?
    By musaulker in forum Newbie
    Replies: 4
    Last Post: 25th February 2010, 09:43
  3. QBasicTimer never timeout.
    By kunalnandi in forum Qt Programming
    Replies: 5
    Last Post: 30th January 2010, 07:55
  4. Tootip Timeout
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 23rd July 2008, 10:17
  5. QTcpSocket + timeout
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 15th April 2008, 13:38

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.