title: Qt reading from console and stop when Enter has pressed
body: <pre><code>QTextStream cin(stdin);
  QTextStream cout(stdout);
  
  QString path;
  
  cout &lt;&lt; "Set directory to save configuration file: ";
  cout.flush();
  // path = cin.readLine();
  cin &gt;&gt; path;
  </code></pre>
  
  <p>Here is the code. It works fine when you need to enter some text into console. It prints message and then waits until you write some text and then press the Enter key. <strong>BUT</strong>, if you don't want to enter any text and you want to leave <em>path</em> string empty, this code doesn't approach: it doesn't recognize Enter as end of the line/new line, so if you try to press Enter without writing any text, cursor would be only switched to the next line and program would still wait until you'll write something.</p>
  
  <p>So, is there any way to recognize Enter key <strong>NO MATTER</strong> if <em>path</em> string empty or not? Simple: you press Enter key - program stops to read from console.</p>