Creating a tcl shell
-
bq. i want to take text edit in my main window..if i enter any tcl command and hit enter it should have to produce the output of the corresponding command
That's why Volker mentioned QProcess above. Take the command from the lineEdit, execute it via QProcess, read the process output in and write it to your output window.
-
Example is given in in the "doc":http://developer.qt.nokia.com/doc/qt-4.8/qprocess.html#running-a-process .
You can use read(),write(), readAll() etc. -
Thanks for all of your replies..i was written the code like this
@
process->new QProcess(this);
process->start("tclsh");
process->waitForFinished(-1);
process->start("puts" QStringlist<<"helloworld");
process->waitForFinished();
QByteArray result = process->readAllStandardOutput();
textEdit->append(result);
@here in the firststart process i just convert the console window into tclshell and next process start i just execute a simple tcl command and set the output into text edit ...i was not getting any output and no errors also..some one please tell what is the wrong here.....
-
Did you read an understand the QProcess docs?
bq. bool QProcess::waitForFinished ( int msecs = 30000 )
Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.So, why do you expect to be able to write to that process if it has finished already?
You will have to use signals/slots with your process to be able to read and write continuously.
-
for future reference, you can use this;
http://qconsole.sourceforge.net/