The reason I have BaseView inheriting from QAbstractItemView is because inside it I make calls like:<br><br>self.setItemDelegate(...)<br>self.setDragEnabled(...)<br>self.setEditTriggers(...)<br><br>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.<br>
<br>Any ideas of a better way to achieve this without duplicating code between the 2 views?<br><br>Thanks<br><br><div class="gmail_quote">On Mon, Feb 22, 2010 at 8:45 PM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On 22.02.10 19:45:31, Jugdish wrote:<br>
> I have my own subclasses of QTreeView and QTableView, called MyTableView and<br>
> MyTreeView. There is a lot of code that is common between my 2 classes, so<br>
> to avoid having tons of duplicate code, I was thinking of having a base<br>
> class derived from QAbstractItemView that they both derive from.<br>
<br>
</div>This is not possible. All three Qt classes are subclasses of QObject<br>
which doesn't support inheriting from it multiply (directly or<br>
indirectly). You may get undefined behaviour wrt. Qt signal/slots and<br>
who knows what else. However, nothing stops you from not having a base<br>
class for your BaseView at all.<br>
<br>
Andreas<br>
<font color="#888888"><br>
--<br>
A long-forgotten loved one will appear soon.<br>
<br>
Buy the negatives at any price.<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</font></blockquote></div><br>