Results 1 to 3 of 3

Thread: QProcess finishes but never emits finished signal

  1. #1
    Join Date
    Jun 2011
    Posts
    17
    Qt products
    Qt3
    Platforms
    MacOS X

    Default QProcess finishes but never emits finished signal

    My QProcess which is the command line version of my application that I am designing a GUI has really weird behaviour.
    These are the signals I connect before starting the QProcess. What is happening is when the process has a problem like being unable to open the input file, the QProcess does not actually finish or exit. When looking at CPU usage the QProcess stays open but dormant at 0% usage.

    connect(CGC, SIGNAL(started()), this, SLOT(SV_CGC_Started()));
    connect(CGC, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(SV_CGC_Ended(int,QProcess::ExitStatus)));
    connect(CGC, SIGNAL(readyRead()), this, SLOT(SV_CGC_readyRead()));
    CGC->start(program,arguments);

    Very stumped on this one.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: QProcess finishes but never emits finished signal

    when the process has a problem like being unable to open the input file, the QProcess does not actually finish or exit.
    You said that this is your application, so its your responsibility to implement such behavior. You need to return from main() or call exit(int) to close the command line application, then the associated process will be finished.

  3. #3
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QProcess finishes but never emits finished signal

    How QProcess can emit finished signal if it really doesn't finish? Make your QProcess code exit in case of any error.
    Oleg Shparber

Similar Threads

  1. QThread wait for signal finishes
    By ArkKup in forum Newbie
    Replies: 1
    Last Post: 21st November 2011, 04:47
  2. Passing pointer to object that emits a signal
    By Gadgetman53 in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2011, 21:04
  3. Replies: 3
    Last Post: 2nd April 2011, 13:13
  4. Replies: 4
    Last Post: 23rd January 2011, 10:08
  5. QProcess object not emitting finished(int) signal
    By Tiansen in forum Qt Programming
    Replies: 13
    Last Post: 14th November 2008, 12:17

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.