Results 1 to 9 of 9

Thread: QProcess Problem

  1. #1
    Join Date
    Sep 2007
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess Problem

    Hi!
    Using CentOS 5.2 , KDevelop 3.5, KDE 3.59

    Qt Code:
    1. m_Process = new QProcess(this);
    2. connect(m_Process,SIGNAL(readyReadStandardOutput()), this,SLOT(ProcessLine()));
    3. m_Process->setProcessChannelMode(QProcess::ForwardedChannels);
    4. m_Process->exec(app,args);
    5. if (m_Process->waitForFinished())
    6. return;
    To copy to clipboard, switch view to plain text mode 

    My Program is a simple wrapper for p7Zip, I got everything to work except the progressbar, I read in the docs that QProcess::exec forwords the output of the child process to the main process.

    How do I get this info .

    ps: I did try (this) in the connect function , but the output on the compiler window told me that there was no signal by that name.

    Thanks for your help!
    Patrick.
    Last edited by jpn; 19th August 2008 at 18:49. Reason: missing [code] tags

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

    Default Re: QProcess Problem

    Quote Originally Posted by pmabie View Post
    if (m_Process->waitForFinished())
    If you will wait for the process here, your GUI won't work, because you will block the event loop. Better connect to the finished() signal.

    Quote Originally Posted by pmabie View Post
    I did try (this) in the connect function , but the output on the compiler window told me that there was no signal by that name.
    How did you declare ProcessLine slot?

  3. #3
    Join Date
    Sep 2007
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess Problem

    public slot

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

    Default Re: QProcess Problem

    Did you remember about Q_OBJECT macro?

  5. #5
    Join Date
    Sep 2007
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess Problem

    it's in my class .
    Patrick.

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

    Default Re: QProcess Problem

    Could you post the exact error message? Maybe there's a typo in slot name?

  7. #7
    Join Date
    Sep 2007
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess Problem

    Sure will .
    Patrick.

  8. #8
    Join Date
    Sep 2007
    Posts
    20
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess Problem

    here's my problem , can I get the Standard out that is being sent to my program from the QProcess?

    Thanks.

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

    Default Re: QProcess Problem

    When you make that ProcessLine() slot work, you can use QProcess::readAll() or QProcess::readLine().

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

    pmabie (25th August 2008)

Similar Threads

  1. QProcess and kfmclient exec problem
    By ramazangirgin in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2008, 08:31
  2. QProcess problem (Main program hangs)
    By sincnarf in forum Qt Programming
    Replies: 5
    Last Post: 11th October 2007, 09:26
  3. QThread and QProcess problem
    By codebehind in forum Qt Programming
    Replies: 13
    Last Post: 7th August 2007, 08:11
  4. Quoting problem with QProcess
    By the_bis in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2006, 11:24
  5. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30

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.