Results 1 to 5 of 5

Thread: running QProcess in QThread from main Window

  1. #1
    Join Date
    Oct 2013
    Location
    Bangalore,India
    Posts
    64
    Thanks
    21
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default running QProcess in QThread from main Window

    I want to start a new thread from button click of main window, which in turn will run a QProcess to launch gstreamer.
    The main objective is to launch QProcess from button click in mainWindow without blocking the GUI.

    I am unable to find the correct approach to do it.Not able to make signal/slot connection.
    Pl tell the right approach to do it.
    Any sample code will be highly appreciated.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: running QProcess in QThread from main Window


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

    prkhr4u (4th February 2014)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: running QProcess in QThread from main Window

    Quote Originally Posted by prkhr4u View Post
    I am unable to find the correct approach to do it.Not able to make signal/slot connection.
    You add a slot to your main window, you connect the button's clicked() signal to it.

    Not sure what you need the thread for, QProcess works asynchronously by itself.

    Cheers,
    _

  5. #4
    Join Date
    Oct 2013
    Location
    Bangalore,India
    Posts
    64
    Thanks
    21
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: running QProcess in QThread from main Window

    thank you Lesiok, QProcess::startDetached() was just I was looking for.
    I wanted to start QProcess so that it does not block my existing GUI.

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

    Default Re: running QProcess in QThread from main Window

    Unless you use QProcess::execute() or any QProcess::waitForX() function nothing in QProcess blocks.

Similar Threads

  1. Replies: 1
    Last Post: 4th October 2012, 14:49
  2. Replies: 15
    Last Post: 24th December 2011, 12:07
  3. Replies: 0
    Last Post: 26th August 2010, 10:44
  4. Replies: 11
    Last Post: 11th August 2008, 09:14
  5. Replies: 15
    Last Post: 23rd March 2007, 16:16

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.