title: QMainWindow no longer active window
body: <p>I'm making a simple game with Qt and I'd like to pause the game when the user switches to a different window (this could be by minimizing it or by accidentally clicking on a window beside it, etc).  My game is wrapped in a QMainWindow, so I'd like to be able to detect when that loses focus.</p>
  
  <p>I've tried a few different methods for this, but I haven't been successful.  I first tried overloading QMainWindow's focusOutEvent, but this method was only called when I first gave the window focus with setFocus.  I also tried to overload the window's event(QEvent *) method to check for QEvent::ApplicationActive and QEvent::ApplicationDeactivate.</p>
  
  <p>I would post the code for my QMainWindow but there isn't much to show, I literally just tried to implement those two methods but neither were called.  I did nothing else to set up those methods (maybe I'm missing a step?).</p>
  
  <p>Does anyone know a good way to determine if your QMainWindow has "lost focus"?</p>