title: Qt console application problems when reading input
body: <p>When I try to get input from a Qt console application the program is not working as I expect it to. The following works as expected:</p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  #include &lt;QTextStream&gt;
  
  QTextStream cout(stdout);
  QTextStream cin(stdin);
  
  int main()
  {
      QString msg("Hello world!");
      cout &lt;&lt; msg &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>Hello world!
  </code></pre>
  
  <p>But as soon as I add,</p>
  
  <pre><code>... 
  int main()
  {
      QString msg("Hello world!");
      cout &lt;&lt; msg &lt;&lt; endl;
  
      cout &lt;&lt; "Enter new message: ";
      msg = cin.readLine();
      cout &lt;&lt; endl &lt;&lt; msg &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Hello world!
  </code></pre>
  
  <p>is displayed but then the program waits for the input before displaying the prompt to enter text, instead of first displaying the prompt and THEN reading the input. The entered text displays together with (after) the prompt when entered.</p>
  
  <p>I've been trying to resolve this for a couple of hours to no avail.</p>