QProcess within a QThread
-
I am using QProcess to run an external command that will take a while. I am using QProcess so I can capture the standard output from the command, using the readyReadStandardOutput() signal. The command processes a multi-page document spits out periodic data that I can harness in real time to update a QProgressDialog to update itself. This all works swell when it's all in the main UI thread. Except that, of course, the UI is not that responsive, because the command can still take a while between outputs.
Enter QThread. I am having no luck getting this to work well. When the QThread starts the QProcess, I am no longer getting the readyReadStandardOutput() signal.
If anyone has a working example of this sort of thing, I would love to see it. The docs are not helping. Maybe I should read them. ;-)
-
Do you have any messages on a console when you run your app?
Something like "unable to connect".
Could you show how do you start a thread, launch a process and connect the signals. -
Thanks for replying. I got this worked out. It was simple. I was waiting for he process (and the thread) when I did not need to. I ditched the thread and just let the QProcess start. Then connect up to canceled() and finished(int). Now it's all working as I had hoped.