Results 1 to 4 of 4

Thread: [QProcess] - executing application problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default [QProcess] - executing application problem

    Hello!

    I want my application to execute the other application, so I wrote code like this:

    Qt Code:
    1. void MainWindow::runApp()
    2. {
    3. QProcess *proc;
    4. proc = new QProcess( this );
    5. proc->start("/app", QStringList() << "-qws");
    6. }
    To copy to clipboard, switch view to plain text mode 

    It's slot triggered by button. Application runs, but when I close It parent application is closing too with:

    Qt Code:
    1. QProcess: Destroyed while process is still running
    To copy to clipboard, switch view to plain text mode 

    What I'm doing wrong?

    thanks in advance
    best regards
    Tomasz

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: [QProcess] - executing application problem

    Most likely you need the startDetached

  3. The following user says thank you to Zlatomir for this useful post:

    Tomasz (30th July 2010)

  4. #3
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: [QProcess] - executing application problem

    Quote Originally Posted by Zlatomir View Post
    Most likely you need the startDetached
    Thaks! startDetached works fine, but I needed to run child application without "-qws" parameter.

    best regards
    Tomasz

  5. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: [QProcess] - executing application problem

    Well, if you look in the documentation you see this for the destructor of QProcess:

    Destructs the QProcess object, i.e., killing the process.
    It's pretty obvious that when you delete the process, the application will exit too.
    Note that this is not what you want to do, you want to close the application gracefully, in a controlled way, otherwise you might have data loss.

Similar Threads

  1. Error while executing a application - Gtk WARNING
    By augusbas in forum Qt Programming
    Replies: 1
    Last Post: 12th June 2010, 12:25
  2. Replies: 0
    Last Post: 19th March 2010, 08:05
  3. A problem with executing Qt 4.5.0
    By Dante in forum Installation and Deployment
    Replies: 20
    Last Post: 15th March 2009, 19:50
  4. Problem executing process
    By EricF in forum Qt Programming
    Replies: 4
    Last Post: 25th January 2008, 16:04
  5. Pause executing QProcess
    By bravetanveer in forum Qt Programming
    Replies: 1
    Last Post: 3rd December 2006, 07:55

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
  •  
Qt is a trademark of The Qt Company.