Results 1 to 4 of 4

Thread: Interactive QProcess

  1. #1
    Join Date
    Jul 2009
    Posts
    23
    Thanks
    2

    Default Interactive QProcess

    I'm trying to execute a process using QProcess. This process performs its job until it is interrupted by pressing the 'q' key.

    I was trying to simulate pressing the 'q' key by sending the character to the process via the write() function. That did not work.

    Then I found this Qt Labs blog post which I think is trying to achieve what I want. The problem is, I can't understand what the guy is doing especially the meaning of dup and dup2.

    I would be very grateful if someone could explain.

    Thank You

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Interactive QProcess

    one question .. out of scope but ...
    if u press key "q" the QProcess application is closing or complete a task but not killed ..
    if the external application be killed when user press "q" ... then u can use keyPressEvent , catch the key "q" and close the process QProcess::terminate() ..
    "Behind every great fortune lies a crime" - Balzac

  3. #3
    Join Date
    Jul 2009
    Posts
    23
    Thanks
    2

    Default Re: Interactive QProcess

    Quote Originally Posted by wagmare View Post
    one question .. out of scope but ...
    if u press key "q" the QProcess application is closing or complete a task but not killed ..
    if the external application be killed when user press "q" ... then u can use keyPressEvent , catch the key "q" and close the process QProcess::terminate() ..
    That does kill the application (that's what I was doing). However when the 'q' is pressed, apart from terminating, it does some other important stuff before quitting.

  4. #4
    Join Date
    Jul 2009
    Posts
    23
    Thanks
    2

    Default Re: Interactive QProcess

    Update:

    I was using kill() to kill the application; terminate() does nothing.

    When the application stops and waits for user input I can use write() to send input, and that does work.

    What does not work is when I send input while the application is working.

Similar Threads

  1. Detect First QProcess finished in a group and kill other
    By Davidaino in forum Qt Programming
    Replies: 3
    Last Post: 11th July 2008, 13:53
  2. QProcess exitStatus()
    By user_mail07 in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2008, 21:51
  3. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2007, 00:11
  4. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 01:25
  5. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 14:30

Tags for this Thread

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.