Results 1 to 3 of 3

Thread: Starting QProcess from QThread

  1. #1
    Join Date
    Jun 2012
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Starting QProcess from QThread

    I was using QThreads in Qt where my need is to launch a command-line executable from within a Qt thread and run the same within the thread's context. I have used the below mentioned code for the same which seems to be running fine. However, I wanted to know if this kind of usage is permitted since we are launching a QProcess from within a QThread.

    Qt Code:
    1. void Help_Menu_Thread::run()
    2. {
    3. Insert_Log("INFO::Help file referred by Admin");
    4. QProcess HelpStart;
    5. HelpStart.execute("c:\\windows\\hh.exe LPRS_help.chm");
    6. HelpStart.close();
    7. }
    To copy to clipboard, switch view to plain text mode 

    Awaiting your response.

    Regards,
    Sandeep

  2. #2
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Starting QProcess from QThread

    I would just use QProcess::startDetached and not use a thread at all for this kind of stuff.

  3. #3
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Starting QProcess from QThread

    Since, Thread is a lightweight and process is the heavyweight, So it is unnecessary to define a heavyweight process under lightweight. I am not confirmed about that, but that what my perception says....

Similar Threads

  1. QThread to run one or more QProcess
    By smhall316 in forum Newbie
    Replies: 0
    Last Post: 27th September 2011, 20:39
  2. Replies: 2
    Last Post: 18th December 2010, 22:13
  3. QProcess starting minimized
    By kobus in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2009, 23:01
  4. QProcess starting minimized
    By moe in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2007, 08:32
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.