Signature of StandardItemModel.headerData()

Stephen Waterbury waterbug at pangalactic.us
Mon Feb 6 16:10:53 GMT 2023


On 2/6/23 4:48 AM, Phil Thompson wrote:

> On 06/02/2023 02:16, Stephen Waterbury wrote:
>> According to the C++ documentation
>>
>> https://doc.qt.io/archives/qt-5.12/qstandarditemmodel.html#headerData
>>
>> ... it takes 2 positional args (section, orientation) and 1 keyword arg
>> (role).  If I call it with the 2 positional args, I get a traceback 
>> saying
>>
>> TypeError: headerData() missing 1 required positional argument: 'role'
>>
>> Did pyqt define the 'role' arg as positional?  And if so, why?
>
> No.
>
> Please provide a short working example that demonstrates the problem.
>
> Phil
Oops.  Creating the SSCCE proved that the signature in pyqt is indeed 
correct --
my subclass of QStandardItemModel was the culprit -- it redefined headerData
with "role" as a positional arg.  Sheesh, sorry for the noise! :/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20230206/3f8a6632/attachment.htm>


More information about the PyQt mailing list