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

linuxoidoz at yahoo.com.au linuxoidoz at yahoo.com.au
Fri Feb 19 06:02:47 UTC 2010


All I've done was to move 

proc = new QProcess(this);

from the MainWindow class constructor to the slot and it's working now, that is on readyReadStandardOutput(), it writes my text into a QTextEdit box. But how can I output the process output into the QTextEdit? This:

               [Q_SLOT]
               private void updateLog() {
                       QByteArray data = proc.ReadAllStandardOutput();
                       QTextCodec codec = QTextCodec.CodecForUtfText(data);
                       string str = codec.ToUnicode(data);
                       txtEdit.Append(str);
               }

only crashes the app with "System.MemberAccessException: Cannot create an instance of Qyoto.QTextCodec because it is an abstract class". I used the Qt C++ example and modified it to C#. There are many examples which show you can cast byte array type to string with QString(byteArray), but there's no QString in Qyoto, and (String)byteArray complains it can't convert QBytaArray to string. I'd appreciate your help. Thank you.



More information about the Kde-bindings mailing list