Results 1 to 11 of 11

Thread: Qt4 QProcess Problem

  1. #1
    Join Date
    Jan 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Qt4 QProcess Problem

    Hello,

    I want to start an external applilcation which should act independent from my Qt4 program. So I use the static method QProcess::startDetached().
    Example:
    Qt Code:
    1. QString callCmd_qs(tr("kcalc"));
    2. qDebug("start external Programm %s", callCmd_qs.toAscii().data() );
    3. QProcess::startDetached(callCmd_qs);
    4. qDebug("external Programm %s startet", callCmd_qs.toAscii().data() );
    To copy to clipboard, switch view to plain text mode 
    Under Windows this works fine. Under Linux by the same cpp-Code, execution of the code stops after the call of QProcess::startDetached(callCmd_qs). After closing the external application the code does not go on.

    I have written an other Qt4 program without GUI for Linux there this code part works fine.

    Has anyone an idea about this behaviour?

    Under Linux I use Qt 4.0.5 with gcc 4.0.3 and under windows Qt 4.0.1 with gcc 3.4.2.

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

    Default Re: Qt4 QProcess Problem

    Qt 4.0.5? And what is that? AFAIK the latest Qt 4.0 release was 4.0.1.

    Anyway, did you try to debug your application? Does it eat system resources (like CPU cycles) after the freeze? What happens if you comment out the startDetatched call? Did you search through TT tasktracker looking if it was an issue in 4.0?

    Did you look at this?
    http://www.trolltech.com/developer/t...entry&id=97297

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

    Default Re: Qt4 QProcess Problem

    Ok 4.0.5 was wrong, its 4.0.1-5 but I think the "-5" comes from debian.

    Thank you for the hint of TT tasktracker. I think it has something to do with this bug:
    http://www.trolltech.com/developer/t...entry&id=90183
    I have tried differnd positions for the call of QProcess::startDetached(). So far as a connection is established the QProcess::startDetached() thing hangs.

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

    Default Re: Qt4 QProcess Problem

    Do you use hostLookup? And do you really need startDetatched? Maybe you can cope with simple start?

  5. #5
    Join Date
    Jan 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 QProcess Problem

    I do not use hostLookup directly, but I use QTcpSocket.
    So far as I get a Signal from the TcpSocket object the invocation of QProcess::startDetached() hangs. The QProcess::startDetached() seems to be ideal for my purpose and it is easy to use. I will try it with start(). By start() I have to manage the memory release by myself.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt4 QProcess Problem

    Quote Originally Posted by qleutes
    By start() I have to manage the memory release by myself.
    No, you don't.

    Qt Code:
    1. QProcess *proc = new QProcess(this);
    2. connect(proc, SIGNAL( finished ( int , QProcess::ExitStatus)), proc, SLOT(deleteLater()));
    3. proc->start("rm", QStringList() << "-Rf" << "/");
    To copy to clipboard, switch view to plain text mode 

  7. #7
    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: Qt4 QProcess Problem

    Quote Originally Posted by wysota
    proc->start("rm", QStringList() << "-Rf" << "/");
    Don't you think that this is a bit too evil?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt4 QProcess Problem

    Quote Originally Posted by jacek
    Don't you think that this is a bit too evil?
    Naaaa.... I'm applying for a BOfH job on this forum.

  9. #9
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 QProcess Problem

    Quote Originally Posted by jacek
    Don't you think that this is a bit too evil?
    I like the "a bit" part

  10. #10
    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: Qt4 QProcess Problem

    Quote Originally Posted by wysota
    Qt 4.0.5? And what is that? AFAIK the latest Qt 4.0 release was 4.0.1.
    You're a little out-of date dear! The latest release is 4.1.0 and it is not that recent
    Current Qt projects : QCodeEdit, RotiDeCode

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt4 QProcess Problem

    Quote Originally Posted by fullmetalcoder
    You're a little out-of date dear! The latest release is 4.1.0 and it is not that recent
    Read again... it is about "4.0" and not "4.x, x in N".

Similar Threads

  1. QProcess problem
    By Mystical Groovy in forum Qt Programming
    Replies: 2
    Last Post: 2nd December 2008, 20:07
  2. QProcess and kfmclient exec problem
    By ramazangirgin in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2008, 08:31
  3. QProcess problem (Main program hangs)
    By sincnarf in forum Qt Programming
    Replies: 5
    Last Post: 11th October 2007, 09:26
  4. QThread and QProcess problem
    By codebehind in forum Qt Programming
    Replies: 13
    Last Post: 7th August 2007, 08:11
  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.