Results 1 to 5 of 5

Thread: running external console program by gui program

  1. #1
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default running external console program by gui program

    hi
    im gonna run a console program by gui program!
    i know that i should use Qprocess but when i use this command in my mainwindow constructor only console program is running and my gui doesent until i close console program!

    what should i do?
    is there any mainwindow load event?
    thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: running external console program by gui program

    Show us how you use QProcess in your ctor. There you probably doing something wrong.

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

    alireza.mixedreality (24th April 2010)

  4. #3
    Join Date
    Apr 2010
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: running external console program by gui program

    at the end of constructor:

    QString run="./OperatorServer";
    Qprocess *executable = new QProcess(this);
    executable->execute(run);

  5. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: running external console program by gui program

    I knew it execute blocks your main thread, therefore the GUI never pop up. Use QProcess::start() instead (note: it is asynchronous) and use proper connections to interact with your shell program.

  6. The following user says thank you to Lykurg for this useful post:

    alireza.mixedreality (24th April 2010)

  7. #5
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: running external console program by gui program

    Try QProcess::startDetached

Similar Threads

  1. [QProcess] Calling console program
    By bgarisn in forum Newbie
    Replies: 3
    Last Post: 25th February 2010, 16:11
  2. Replies: 7
    Last Post: 19th January 2008, 16:29
  3. QProcess start a console program
    By Shawn in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2007, 13:38
  4. Console Program Problem
    By ball in forum Qt Programming
    Replies: 9
    Last Post: 28th May 2006, 10:05
  5. Replies: 1
    Last Post: 17th May 2006, 01:23

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.