title: Check if a Key is Down with Qt
body: <p>I am playing around with some graphics, and I have implemented simple camera movement with the arrow keys. My first approach was to override <code>keyPressEvent</code> to do something like this:</p>
  
  <pre><code>switch(key)
  {
     case up: MoveCameraForward(step); break;
     case left: MoveCameraLeft(step); break;
     ...
  }
  </code></pre>
  
  <p>This doesn't work as I wish it would. When I press and hold, for example, the forward key, the camera moves forward "step" units, then halts for a while and then continues moving. I am guessing that this is how the event is generated, in order to avoid multiple events in case of a little bit long keypress.</p>
  
  <p>So, I need to poll the keyboard in my <code>Paint()</code> routine. I haven't found how to do it with Qt. I thought of having a <code>map&lt;Key, bool&gt;</code> which would be updated in <code>keyPressEvent</code> and <code>keyReleaseEvent</code> and poll that map in <code>Paint()</code>. Any better ideas? Thanks for any insights.</p>