[Kde-bindings] C#, Qyoto, Qt - How to read output from QProcess?

Arno Rehn arno at arnorehn.de
Wed Feb 17 15:32:30 UTC 2010


On Wednesday 17 February 2010 13:31:12 linuxoidoz at yahoo.com.au wrote:
> Hello,
> 
> I'm running an ffmpeg process with the following parameters: "ffmpeg -i
> video.avi video.mp4" and want to display the ffmpeg output in a QTextEdit.
> Here's my sample code (ffmpeg DOES work, I just can't get its output):
> 
> 		private void StartCodec() {
> 			string program = "ffmpeg";
> 			List<string> arguments = new List<string>();
> 			arguments.Add("-i");
> 			arguments.Add("video.avi");
> 			arguments.Add("video.mp4");
> 			proc.Start(program, arguments);
> 			Connect(proc, SIGNAL("readyReadStandardOutput()"), this,
> SLOT("updateLog()")); }
> 
> 		[Q_SLOT]
> 		private void updateLog() {
> 			QByteArray data = proc.ReadAllStandardOutput();
> 			QTextCodec codec = QTextCodec.CodecForUtfText(data);
> 			string str = codec.ToUnicode(data);
> 			txtEdit.Append(str);
> 		}
> 
> I've checked with Qt Manual, it says:
> "void QProcess::readyReadStandardOutput ()   [signal]
> This signal is emitted when the process has made new data available through
> its standard output channel (stdout). It is emitted regardless of the
> current read channel."
> 
> But neither 'readyReadStandardOutput', nor 'ReadyReadStandardOutput', nor
> any other Ready signal seems to be available in Qyoto for QProcess. And
> mono complains: "Object::connect: No such signal
> QProcess::ReadyReadStandardOutput()".
Works for me. Check for typos. Don't capitalize the first letter. The code you 
pasted above should work.

> Also I can't seem to find QString anywhere. Is it available in Qyoto?
QString is mapped to a normal .NET string.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list