title: Triple inheritance causes metaclass conflict... Sometimes
body: <p>Looks like I stumbled upon a metaclass hell even when I didn't wanted anything to do with it.</p>
  
  <p>I'm writing an app in Qt4 using PySide. I want to separate event-driven part from UI definition, which is generated from Qt Designer files. Hence I create a "controller" classes, but to ease my life I multiple-inherit them anyways. An example:</p>
  
  <pre><code>class BaseController(QObject):
      def setupEvents(self, parent):
          self.window = parent
  
  class MainController(BaseController):
      pass
  
  class MainWindow(QMainWindow, Ui_MainWindow, MainController):
      def __init__(self, parent=None):
          super(MainWindow, self).__init__(parent)
  
          self.setupUi(self)
          self.setupEvents(self)
  </code></pre>
  
  <p>This works as expected. It also has inheritance from (<code>QDialog</code>, <code>Ui_Dialog</code>, <code>BaseController</code>). But when I subclass <code>BaseController</code> and try to inherit from said subclass (in place of <code>BaseController</code>), I receive an error:</p>
  
  <blockquote>
    <p>TypeError: Error when calling the metaclass bases
        metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases</p>
  </blockquote>
  
  <p>Clarification: Both <code>QMainWindow</code> and <code>QDialog</code> inherit from <code>QObject</code>. <code>BaseController</code> must also inherit from it because of Qt event system peculiarities. Ui_ classes only inherit from simple Python object class. I searched for solutions, but all of them involve cases of intentionally using metaclasses. So I must be doing something terribly wrong.</p>
  
  <p>EDIT: My description may be clearer by adding graphs.</p>
  
  <p>Working example:</p>
  
  <pre><code>QObject
  |      \___________________
  |            object        |
  QMainWindow     |          BaseController
  |      /---Ui_MainWindow   |
  |      |                   MainController
  MainWindow-----------------/
  </code></pre>
  
  <p>Another working example:</p>
  
  <pre><code>QObject
  |      \___________________
  |            object        |
  QDialog         |          BaseController
  |      /---Ui_OtherWindow  |
  |      |                   |
  OtherWindow----------------/
  </code></pre>
  
  <p>Not working example:</p>
  
  <pre><code>QObject
  |      \___________________
  |            object        |
  QDialog         |          BaseController
  |      /---Ui_OtherWindow  |
  |      |                   OtherController
  OtherWindow----------------/
  </code></pre>