[mythtv-users] QT programming question
Sascha Vogt
FunkyFish at gmx.net
Tue Jan 20 14:38:15 UTC 2009
Hi Nasa,
Nasa schrieb:
> The issue surrounds QProcess, example code follows:
>
> QProcess proc;
> QString program;
> QStringList args;
>
> program = "some path to script/program";
> args += " - ";
> proc.start(program,args)
>
> if (QProcess::Running == proc.state())
> {
> //do something
> }
>
> blah, blah....
>
> The problem is that the if statement is never done. Infact, in my
> testing I have never seen any form of that if statement work -- even
> though the QT docs suggest that it should. Could someone clue me
> into why this isn't working?
Did you try to check proc.state() with a debugger to see, what's the
actual return value?
I'm not familiar with QT, but some wild guesses:
proc.start() may block until the external program is finished, therefore
proc.state() would be NotRunning. proc.start() may immediately move on,
therefore proc.state() would return Starting.
In general I think you should use the signals "started" and "error" to
track the process.
Greetings
-Sascha-
More information about the mythtv-users
mailing list