PDA

View Full Version : running QProcess in QThread from main Window



prkhr4u
3rd February 2014, 10:27
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.

Lesiok
3rd February 2014, 10:35
Read about QProcess::startDetached.

anda_skoa
3rd February 2014, 11:13
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,
_

prkhr4u
4th February 2014, 03:40
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.

ChrisW67
4th February 2014, 05:25
Unless you use QProcess::execute() or any QProcess::waitForX() function nothing in QProcess blocks.