[PyQt] Invalid protected on QItemDelegate ?

Phil Thompson phil at riverbankcomputing.co.uk
Fri Dec 21 18:33:52 GMT 2007


On Friday 21 December 2007, Peter Shinners wrote:
> I am creating a custom QAbstractItemDelegate. It mostly acts as a proxy
> for standard QTreeWidget delegate. I cannot call the editorEvent()
> method on the original delegate because of this.
>
>     return self.__real.editorEvent(event, model, option, index)
> RuntimeError: no access to protected functions or signals for objects
> not created from Python
>
> The documentation states the editorEvent is a public method, so I'm
> surprised to see this. Without calling the correct delegate the checkbox
> clicking action for QTreeWidgetItems is not processed.

It's protected in QItemDelegate (which is what you mentioned in the subject). 
So what is the type of self.__real?

It would be easier if you provied some code - preferably a small, complete 
example.

> Or better than all this; is there an easier way to override the cell
> painting of a QTreeWidgetItem?

Phil


More information about the PyQt mailing list