Results 1 to 2 of 2

Thread: speed up qprocess readstdout

  1. #1
    Join Date
    Jan 2006
    Qt products

    Default speed up qprocess readstdout

    im making a qprocess running a program and i have a textfield that prints the output of the program.

    im using the folloiwn code to get the output

    Qt Code:
    1. void mainForm::readFromStdout()
    2. {
    3. outputTextEdit->append( proc->readStdout() );
    4. }
    6. and
    8. connect( proc, SIGNAL(readyReadStdout()),
    9. this, SLOT(readFromStdout()) );
    To copy to clipboard, switch view to plain text mode 
    everything works fine. except the only problem is, this output reads in chunks, rather than smoothly.

    even in the example from qt3 for qprocess it says
    Qt Code:
    1. void UicManager::readFromStdout()
    2. {
    3. // Read and process the data.
    4. // Bear in mind that the data might be output in chunks.
    5. output->append( proc->readStdout() );
    6. }
    To copy to clipboard, switch view to plain text mode 

    i think it has to do with the buffer size set in qprocess->readStdout(). im not sure how to change this. is there anyway to i can make the output append more frequently?

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: speed up qprocess readstdout

    You'd have to change the buffer of the pipe between your application and the external process, but it would slow down both apps and the operating system itself. If you want smooth output, store the data from external process instead of appending it to the text field directly and use a timer to fetch the data from your storage and feed it to the text box.

    You might also want to take a look at QProcess::canReadLineStdout() and QProcess:readLineStdout() to read data line by line.

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 readStdOut index
    By user_mail07 in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2008, 20:37
  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. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 01:32


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.