Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating a tcl shell
Forum Updated to NodeBB v4.3 + New Features

Creating a tcl shell

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 4.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mahesh
    wrote on last edited by
    #1

    hi , some please tell me is it possible to create a tcl shell using qt..if possible some one please tell me how it is...

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      I don't know exactly what you want to do.

      One possible option is [[Doc:QProcess]] that starts the tcl interpreter in a separate process. You would have to connect to its stdin and stdout.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mahesh
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Scylla
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rahul Das
            wrote on last edited by
            #5

            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.


            Declaration of (Platform) independence.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mahesh
              wrote on last edited by
              #6

              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.....

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                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.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  yoavmil
                  wrote on last edited by
                  #8

                  for future reference, you can use this;
                  http://qconsole.sourceforge.net/

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved