Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
None
-
5.11.0
-
None
-
Mac OSX 10.13.6.
Python 3.7.0
PySide2 5.11.1a1.dev1532951062
Description
This code snippet demostrates the problem I am having.
class Item_Delegate (QStyledItemDelegate): def __init__ (self, parent): super (Item_Delegate, self).__init__ (parent) def paint (self, painter, option, index): QStyledItemDelegate.paint(painter, option, index) # Fails super(Item_Delegate, self).paint(painter, option, index) # But this works
I have implemented a subclass of QStyledItemDelgate. If I attempt to call the draw method of the superclass, I am successful if I call the draw (instance) method. But if I call the QStyledItemDelgate class method draw, I get this runtime error when Qt attempts to display the QTableView:
Traceback (most recent call last): File "/Users/davidp/dev/python/pyside_temp/adv_qt/y.py", line 13, in paint QStyledItemDelegate.paint(painter, option, index) # Fails TypeError: descriptor 'paint' requires a 'PySide2.QtWidgets.QStyledItemDelegate' object but received a 'PySide2.QtGui.QPainter'
The code I have reproduced above has my custom delegate sublcassed from QStyledItemDelegate, however the same behavior occurs if I attempt to subclass QAbstractItemDelegate.
I presume that the error is raised when the paint method examines the painter argument. I believe that the code should be have the same whether I call the instance method or the class method.
I have attached a small program that reproduces the problem.