The reason I have BaseView inheriting from QAbstractItemView is because
inside it I make calls like:

self.setItemDelegate(...)
self.setDragEnabled(...)
self.setEditTriggers(...)

and so on. These are all things that are common to both
MyTreeView/MyTableView, and obviously wouldn't work if BaseView had no base
class.

Any ideas of a better way to achieve this without duplicating code between
the 2 views?

Thanks

On Mon, Feb 22, 2010 at 8:45 PM, Andreas Pakulat <ap...@gmx.de> wrote:

> 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.
>
> Andreas
>
> --
> A long-forgotten loved one will appear soon.
>
> Buy the negatives at any price.
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to