title: Pyside uiLoader capture close event signals
body: <p>How does one properly capture the close event coming out of a PySide QtUiTools.QUiLoader() setup?</p>
  
  <p>I can get the instanced class to connect to widgets and everything else, but I am not sure how to intercept the signals in this setup.</p>
  
  <p>Ideally, I want all close calls to pass through my closeEvent (obviously) so that I can ensure that it's safe to close the window. But since my self.closeEvent() is tied to my View(QtWidgets.QMainWindow) and not the self._qt.closeEvent(), I don't know how to get to the self._qt.closeEvent() method to override it in this case.</p>
  
  <p>Or is there a better way to set this up to capture those window events?</p>
  
  <pre><code># Compatible enough with Pyside 2
  from PySide import QtGui as QtWidgets
  from PySide import QtUiTools
  from PySide import QtCore
  
  class View(QtWidgets.QMainWindow):
      def __init__(self, parent=None):
          super(View, self).__init__(parent=parent)
          self.setup()
  
      def closeEvent(self, event):
  
          # Do things
          event.accept()
  
      def setup(self):
          loader = QtUiTools.QUiLoader()
          fy = QtCore.QFile('example.ui')
          fy.open(QtCore.QFile.ReadOnly)
          self._qt = loader.load(fy, self)
          fy.close()
  
          self._qt.pCanceled.clicked(self._qt.close)
  </code></pre>
  
  <p>Doesn't apply:</p>
  
  <p><a href="https://stackoverflow.com/questions/9249500/pyside-pyqt-detect-if-user-trying-to-close-window">PySide / PyQt detect if user trying to close window</a></p>
  
  <p>Close, but PySide doesn't use PyQt's uic and appears to run differently (and didn't work):</p>
  
  <p><a href="https://stackoverflow.com/questions/14834494/pyqt-clicking-x-doesnt-trigger-closeevent">PyQt: clicking X doesn&#39;t trigger closeEvent</a></p>