title: How do I wait for a keypress in a Qt GUI application
body: <p>I am writing a math practice program for my grandson.  I first wrote it as a console app as below and everything worked fine.</p>
  
  <pre><code>for(int i = 0; i &lt;= 9; i++)
  {
      n2Digit = GetNewDigit(iProblemsWorkedArray);
      int validAnswer = add(n1Digit, n2Digit);
      bool noKey = true;
      while(noKey)
      {
          char KeyPressed = getch();
          int KeyAscii = KeyPressed;
          if((KeyAscii &gt;= 48) &amp;&amp; (KeyAscii &lt;= 57) &amp;&amp; (validAnswer &lt; 10))
          {
              studentAnswer = KeyAscii - 48;
              noKey = false;
          }
  
        yada yada...
  
      }
  }         
  </code></pre>
  
  <p>Now I want to write the same thing using the Qt GUI, but found that the </p>
  
  <pre><code>   char KeyPressed = getch();
  </code></pre>
  
  <p>within the while loop no longer works in GUI mode.</p>
  
  <p>I have searched for days and come to the conclusion that I must be phrasing the search wrong.  Would someone please help ?</p>