title: Capturing modifier keys Qt
body: <p>I am trying to understand how to handle various events with Qt and have found an issue I cannot understand with key modifiers e.g. <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>Alt</kbd> etc. I have made a default Qt GUI Application in Qt Creator extending QMainWindow and have found that the following example does not produce understandable results.</p>
  
  <pre><code>void MainWindow::keyPressEvent(QKeyEvent *event)
  {
      qDebug() &lt;&lt; "Modifier " &lt;&lt; event-&gt;modifiers().testFlag(Qt::ControlModifier);
      qDebug() &lt;&lt; "Key " &lt;&lt; event-&gt;key();
      qDebug() &lt;&lt; "Brute force " &lt;&lt; (event-&gt;key() == Qt::Key_Control);
  }
  </code></pre>
  
  <p>Using the modifiers() function on the event never is true while the brute force method returns the correct value. </p>
  
  <p>What have I done wrong?</p>