title: Why does QEvent::ShortcutOverride event occur?
body: <p>I have a QMainWindow with an event filter installed. 
  After I open and close a QDialog the keyboard arrow keys don't respond since QMainWindow receives only ShortcutOverride events instead of KeyPress events.</p>
  
  <p>When I changed the QMainWindow's event filter to handle ShortcutOverride events I got a strange behavior since in my program each key press event is preceded by two shortcut override events (why??).</p>
  
  <p>This doesn't work - events are handled more than once:</p>
  
  <pre><code>bool eventFilter(QObject *, QEvent *event) {
    if(type == QEvent::KeyPress || type == QEvent::ShortcutOverride) {
      QKeyEvent *keyEvent = static_cast&lt;QKeyEvent *&gt;(event);
  
      switch(keyEvent-&gt;key()) {
      case Qt::Key_Up:
      case Qt::Key_Down:
      case Qt::Key_Left:
      case Qt::Key_Right:
        // Do something here
        break;
      default:
        break;
      }
  
      return true;
    }
  
    return false;
  }
  </code></pre>
  
  <p>Why is this happening? Where do those ShortcutOverride events come from?</p>
  
  <h2>Edit:</h2>
  
  <p>As it turns out, QMainwindow loses focus when the QDialog is opened and never gains it back when the QDialog is closed.
  I used setFocus() in the eventFilter of QMainwindow and it seems to do the trick.</p>