title: PyQt Window Focus
body: <p>I am trying to give focus to a window if the user clicks on another window.</p>
  
  <p>Right now i have two windows: Window A is behind, and Window B is in front. When Window B appears, it disables Window A. Now what i want is that whenever the user clicks outside of Window B, it should give focus back to Window B.</p>
  
  <p>Here is the code for Window B:</p>
  
  <pre><code>class window_b(QtGui.QDialog):
      def __init__(self,parent=None):
          super(window_b, self).__init__(parent)
          window_a.setEnabled(False)
          self.ui = Ui_Form_window_b()
          self.ui.setupUi(self)
          self.setFocusPolicy(QtCore.Qt.StrongFocus)
  
      def focusOutEvent(self,event):
          self.setFocus(True)
          self.activateWindow()
          self.raise_()
          self.show()
  </code></pre>
  
  <p>I tried <code>setFocus</code> and <code>activateWindow</code>, but it didnt give focus back to Window B.</p>
  
  <p>Any suggestions?</p>