Results 1 to 5 of 5

Thread: Qprocess for a prompted program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Qprocess for a prompted program

    The last message suggests that your QProcess object is either going out of scope after being allocated on the stack, or being deliberately deleted after being allocated on the heap but before it has finished cleanly. I'd start by looking at the conditions that might destroy the QProcess object.

  2. #2
    Join Date
    May 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Qprocess for a prompted program

    for the search engines...i had the same problem trying to execute gnuplot and writing commands to the QProcess. turns out what i was missing was newlines at the end of each command


    Qt Code:
    1. commands << "set datafile commentschars \";\"\n"
    2. << "set terminal png\n"
    3. << QString("set output \"").append(outfile).append("\"\n")
    4. << "set multiplot layout 2,1\n"
    5. ...
    6.  
    7. gnuplot.start("gnuplot", QIODevice::ReadWrite);
    8. foreach (QString cmd , commands) {
    9. gnuplot.write(cmd.toUtf8());
    10. }
    11. gnuplot.waitForFinished();
    To copy to clipboard, switch view to plain text mode 

    this code worked for me

Similar Threads

  1. Replies: 1
    Last Post: 1st December 2008, 21:02
  2. Detect First QProcess finished in a group and kill other
    By Davidaino in forum Qt Programming
    Replies: 3
    Last Post: 11th July 2008, 12:53
  3. QProcess start a console program
    By Shawn in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2007, 12:38
  4. QProcess problem (Main program hangs)
    By sincnarf in forum Qt Programming
    Replies: 5
    Last Post: 11th October 2007, 09:26
  5. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19

Tags for this Thread

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.