Results 1 to 5 of 5

Thread: problem with QProcess in Qt4

  1. #1
    Join Date
    Sep 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default problem with QProcess in Qt4

    Basically I try to start a process and print the output on a QTextEdit.

    I connect process.readyRead() signal to a slot in which I call process.readAll() to get the output. For some processes, such as "cmd.exe",I successfully get the output; but in the others, such as the "make" utility used in compiling Qt codes, I cannot get any output.

    Can anyone tell me the reason, and how to solve this problem?

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with QProcess in Qt4

    Does make emit text to stdout or stderr?

  3. #3
    Join Date
    Sep 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with QProcess in Qt4

    Quote Originally Posted by e8johan View Post
    Does make emit text to stdout or stderr?
    I use Qt::connect(&process,SIGNAL(readyRead()),this,SLOT (showText())), and in showText() I use process.readAll().

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with QProcess in Qt4

    Quote Originally Posted by kennyxing View Post
    I use Qt::connect(&process,SIGNAL(readyRead()),this,SLOT (showText())), and in showText() I use process.readAll().
    Really? Then make shouldn't cause any trouble... That's the way Edyuk recieve output from compilation and no problem has ever occured on any platform...
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #5
    Join Date
    Sep 2006
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with QProcess in Qt4

    Quote Originally Posted by fullmetalcoder View Post
    Really? Then make shouldn't cause any trouble... That's the way Edyuk recieve output from compilation and no problem has ever occured on any platform...
    The following is pretty much the code. Can you take a look at it?
    Qt Code:
    1. {
    2. process.setWorkingDirectory(file.absolutePath());
    3. QObject::connect(&process,SIGNAL(readyReadStandardOutput()),
    4. this,SLOT(output()));
    5. QObject::connect(&process,SIGNAL(readyReadStandardError()),
    6. this,SLOT(output()));
    7. process.start("make");
    8. }
    To copy to clipboard, switch view to plain text mode 

    The output() slot is:

    Qt Code:
    1. output(){
    2. out.append(QString(process.readAllStandardOutput()));
    3. out.append(QString(process.readAllStandardError()));
    4. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 20th October 2006 at 09:20. Reason: missing [code] tags

Similar Threads

  1. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  2. QProcess problem in accessing stdout
    By aruna in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2006, 17:56
  3. Replies: 16
    Last Post: 7th March 2006, 15:57
  4. Qt4 QProcess Problem
    By qleutes in forum Qt Programming
    Replies: 10
    Last Post: 23rd January 2006, 09:42
  5. QProcess problem with windows batch file
    By bood in forum Qt Programming
    Replies: 11
    Last Post: 6th January 2006, 08:08

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.