[PyQt] Multiple inheritance with item views

Andreas Pakulat apaku at gmx.de
Mon Feb 22 20:45:02 GMT 2010

On 22.02.10 19:45:31, Jugdish wrote:
> 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 is not possible. All three Qt classes are subclasses of QObject
which doesn't support inheriting from it multiply (directly or
indirectly). You may get undefined behaviour wrt. Qt signal/slots and
who knows what else. However, nothing stops you from not having a base
class for your BaseView at all.


A long-forgotten loved one will appear soon.

Buy the negatives at any price.

More information about the PyQt mailing list