title: How to catch Ctrl+C key event with Qt when Ctrl is released before 'C'?
body: <p>I would like to call some custom copy code when the user releases <kbd>Ctrl</kbd>+<kbd>C</kbd>. When <kbd>C</kbd> is released before <kbd>Ctrl</kbd>, Qt sends a key event that matches with <code>QKeySequence::Copy</code>. When <kbd>Ctrl</kbd> is released before <kbd>C</kbd>, the release event does not match.</p>
  
  <p>When the key release event comes in with <kbd>Ctrl</kbd>, is there a way to see if <kbd>C</kbd> is still being held down?</p>
  
  <p>When I don't handle <kbd>Ctrl</kbd> being released first, the event gets passed along and it does a regular copy, which is exactly what I don't want to happen.</p>
  
  <pre><code>bool
  MyWidget::eventFilter(QObject* object, QEvent* event)
  {
     // the text edit box filters its events through here
     if (object == m_text_edit_box)
     {
        if (event-&gt;type() == QEvent::KeyPress)
        {
           QKeyEvent *key_event = static_cast&lt;QKeyEvent*&gt;(event);
  
           if (key_event-&gt;matches(QKeySequence::Copy))
           {
              // don't do anything and don't pass along event
              return true;
           }
        }
        else if (event-&gt;type() == QEvent::KeyRelease)
        {
           QKeyEvent *key_event = static_cast&lt;QKeyEvent*&gt;(event);
  
           if (key_event-&gt;matches(QKeySequence::Copy))
           {
              // we only get in here if 'c' is released before ctrl
              callCustomCopy();
              return true;
           }
        }
     }
  
     // pass along event
     return false;
  }
  </code></pre>