title: Qt Designer can't promote QMainWindow
body: <p>There is something I do not understand about <code>Qt Designer</code>. I have been working with it for a while now, and still I always end up editing the .ui files manually.</p>
  
  <p>As it can be seen in <em>every single</em> tutorial on Qt, one of the very first thing you do when you create a GUI is to subclass <code>QMainWindow</code> - in order to catch and redefine the <code>closeEvent()</code> function, for example.</p>
  
  <p>However, it is not possible to subclass ("promote") <code>QMainWindow</code> in Qt Designer - you can do it with many other class, but not this one.</p>
  
  <p>What I usually do is edit the .ui file and change:</p>
  
  <pre><code>&lt;class&gt;MainWindow&lt;/class&gt;
    &lt;widget class="QMainWindow" name="MainWindow"&gt;
  </code></pre>
  
  <p>by:</p>
  
  <pre><code>&lt; widget class="MyMainWindow" name="MainWindow"&gt;
  </code></pre>
  
  <p>So that my code can subclass <code>QMainWindow</code> properly in my code:</p>
  
  <pre><code>class MyMainWindow(QMainWindow, object):
      ''' I can redefine closeEvent here! '''
  </code></pre>
  
  <p>Obviously, this is weird - and I probably miss something about the right way to do it with Designer. But I cannot find any explanation.</p>
  
  <p>Why is it not possible to subclass <code>QMainWindow</code> in Designer, or how to structure my application differently to avoid the need for it?</p>
  
  <p>Thanks</p>