I have my own subclasses of QTreeView and QTableView, called MyTableView and MyTreeView. There is a lot of code that is common between my 2 classes, so to avoid having tons of duplicate code, I was thinking of having a base class derived from QAbstractItemView that they both derive from. This results in multiple inheritance. I know that the PyQt4 docs say that inheriting from multiple PyQt classes is not supported, but the following bit of code seems to work ok. I'm just wondering what sort of problems I could run into using this approach...<br>
<br>########################################<br>from PyQt4 import *<br><br>class BaseView(QAbstractItemView):<br><br> def setModel(self, model):<br> # do stuff common to MyTableView/MyTreeView here...<br> pass<br>
<br>class MyTableView(QTableView, BaseView):<br><br> def setModel(self, model):<br> QTableView.setModel(self, model)<br> BaseView.setModel(self, model)<br><br>class MyTreeView(QTreeView, BaseView):<br><br>
def setModel(self, model):<br> QTreeView.setModel(self, model)<br> BaseView.setModel(self, model)<br>########################################<br>
<br>