title: Qt Qtermwidget wait for command
body: <p>I hope this question makes sense, I am using <a href="https://github.com/zester/Quantum" rel="nofollow">QTermWidget</a> to create an instance of QTermWidget in Qt Creator 2.4.1, as shown <a href="https://github.com/zester/Quantum/tree/master/QTerminal" rel="nofollow">here</a>. I am able to run it and send commands to the embedded terminal with no problems, however, I would like to be able to send a command to the terminal, wait for the terminal to finish, and then send the other command, like this:</p>
  
  <p>mainwindow.cpp:</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include &lt;QDir&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
      ui-&gt;tabWidget-&gt;setUsesScrollButtons(true);
  
      QIcon::setThemeName("oxygen");
      this-&gt;setWindowIcon(QIcon::fromTheme("utilities-terminal"));
  
      console = new QTermWidget();
  
      QFont font = QApplication::font();
      font.setFamily("Monospace");
      font.setPointSize(12);
  
      console-&gt;setTerminalFont(font);
      console-&gt;setScrollBarPosition(QTermWidget::ScrollBarRight);
      console-&gt;setColorScheme("WhiteOnBlack");
  
      ui-&gt;tabWidget-&gt;insertTab(ui-&gt;tabWidget-&gt;currentIndex(), console,
                               QString(QDir::currentPath()));
  
      QString Home = "ls";
      QString enter = "\r";
      console-&gt;sendText(Home);
      // I would like the terminal to finish the previous command,
      // before sending the next one, right now it just proceeds to
      // the next line of code before it finishes.
      console-&gt;sendText(enter);
  
      console-&gt;sendText(QString cd);
      console-&gt;sendText(enter);
  }
  
  MainWindow::~MainWindow()
  {   
  delete ui;
  }
  </code></pre>
  
  <p>Thanks in advance!</p>